diff --git a/volo-thrift/src/codec/mod.rs b/volo-thrift/src/codec/mod.rs index 7c8923c9..240d912e 100644 --- a/volo-thrift/src/codec/mod.rs +++ b/volo-thrift/src/codec/mod.rs @@ -8,7 +8,7 @@ pub mod default; pub use default::DefaultMakeCodec; -/// [`Decoder`] reads from an [`AsyncRead`] and decodes the data into a [`ThriftMessage`]. +/// [`Decoder`] decodes the data into a [`ThriftMessage`]. /// /// Returning an Ok(None) indicates the EOF has been reached. /// @@ -24,7 +24,7 @@ pub trait Decoder: Send + Sync + 'static { } } -/// [`Encoder`] writes a [`ThriftMessage`] to an [`AsyncWrite`] and flushes the data. +/// [`Encoder`] writes a [`ThriftMessage`] and flushes the data. /// /// Note: [`Encoder`] should be designed to be ready for reuse. pub trait Encoder: Send + Sync + 'static { @@ -39,8 +39,7 @@ pub trait Encoder: Send + Sync + 'static { } } -/// [`MakeCodec`] receives an [`R`] and an [`W`] and returns a -/// [`Decoder`] and an [`Encoder`]. +/// [`MakeCodec`] returns a [`Decoder`] and an [`Encoder`]. /// /// The implementation of [`MakeCodec`] must make sure the [`Decoder`] and [`Encoder`] /// matches. diff --git a/volo/src/net/conn.rs b/volo/src/net/conn.rs index f3391ce9..531063f9 100644 --- a/volo/src/net/conn.rs +++ b/volo/src/net/conn.rs @@ -1,6 +1,7 @@ +#[cfg(target_family = "unix")] +use std::os::fd::{AsRawFd, RawFd}; use std::{ io, - os::fd::{AsRawFd, RawFd}, pin::Pin, task::{Context, Poll}, }; @@ -367,12 +368,12 @@ impl ConnStream { } } +#[cfg(target_family = "unix")] impl AsRawFd for ConnStream { #[inline] fn as_raw_fd(&self) -> RawFd { match self { Self::Tcp(s) => s.as_raw_fd(), - #[cfg(target_family = "unix")] Self::Unix(s) => s.as_raw_fd(), #[cfg(feature = "rustls")] Self::Rustls(s) => s.as_raw_fd(),