Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ quinn_endpoint_setup = ["rpc", "dep:rustls", "dep:rcgen", "dep:anyhow", "dep:fut
spans = ["dep:tracing"]
stream = ["dep:futures-util"]
derive = ["dep:irpc-derive"]
varint-util = ["dep:postcard", "dep:smallvec", "tokio/io-util"]
default = ["rpc", "quinn_endpoint_setup", "spans", "stream", "derive"]

[[example]]
Expand Down
10 changes: 6 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ use crate::channel::SendError;

#[cfg(test)]
mod tests;
#[cfg(feature = "rpc")]
#[cfg_attr(quicrpc_docsrs, doc(cfg(feature = "rpc")))]
pub mod util;
#[cfg(not(feature = "rpc"))]
mod util;

mod sealed {
pub trait Sealed {}
Expand Down Expand Up @@ -1704,6 +1700,10 @@ pub enum RequestError {
#[cfg_attr(quicrpc_docsrs, doc(cfg(feature = "rpc")))]
#[error("error opening stream: {0}")]
Other(#[from] anyhow::Error),

#[cfg(not(feature = "rpc"))]
#[error("(Without the rpc feature, requests cannot fail")]
Unreachable,
}

/// Error type that subsumes all possible errors in this crate, for convenience.
Expand Down Expand Up @@ -1747,6 +1747,8 @@ impl From<RequestError> for io::Error {
RequestError::Connection(e) => e.into(),
#[cfg(feature = "rpc")]
RequestError::Other(e) => io::Error::other(e),
#[cfg(not(feature = "rpc"))]
RequestError::Unreachable => unreachable!(),
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ mod quinn_setup_utils {
#[cfg_attr(quicrpc_docsrs, doc(cfg(feature = "quinn_endpoint_setup")))]
pub use quinn_setup_utils::*;

#[cfg(feature = "rpc")]
#[cfg(any(feature = "rpc", feature = "varint-util"))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add docsrs flags for better docs?

#[cfg_attr(
quicrpc_docsrs,
doc(cfg(any(feature = "rpc", feature = "varint-util")))
)]
mod varint_util {
use std::{
future::Future,
Expand Down Expand Up @@ -382,7 +386,12 @@ mod varint_util {
}
}
}
#[cfg(feature = "rpc")]

#[cfg(any(feature = "rpc", feature = "varint-util"))]
#[cfg_attr(
quicrpc_docsrs,
doc(cfg(any(feature = "rpc", feature = "varint-util")))
)]
pub use varint_util::{AsyncReadVarintExt, AsyncWriteVarintExt, WriteVarintExt};

mod fuse_wrapper {
Expand Down