Trait uni_stream::stream::NetworkStream
source · pub trait NetworkStream: AsyncReadExt + AsyncWriteExt + Send + Unpin + 'static {
type ReaderRef<'a>: AsyncReadExt + Send + Unpin
where Self: 'a;
type WriterRef<'a>: AsyncWriteExt + Send + Unpin
where Self: 'a;
type InnerStream: AsyncReadExt + AsyncWriteExt + Unpin + Send;
// Required methods
fn split(&mut self) -> (Self::ReaderRef<'_>, Self::WriterRef<'_>);
fn into_inner_stream(self) -> Self::InnerStream;
fn local_addr(&self) -> Result<SocketAddr, Error>;
fn peer_addr(&self) -> Result<SocketAddr, Error>;
}Expand description
Used to abstract Stream operations, see tokio::net::TcpStream for details
Required Associated Types§
sourcetype ReaderRef<'a>: AsyncReadExt + Send + Unpin
where
Self: 'a
type ReaderRef<'a>: AsyncReadExt + Send + Unpin where Self: 'a
The reader association type used to represent the read operation
sourcetype WriterRef<'a>: AsyncWriteExt + Send + Unpin
where
Self: 'a
type WriterRef<'a>: AsyncWriteExt + Send + Unpin where Self: 'a
The writer association type used to represent the write operation
sourcetype InnerStream: AsyncReadExt + AsyncWriteExt + Unpin + Send
type InnerStream: AsyncReadExt + AsyncWriteExt + Unpin + Send
Used to get internal specific implementations such as UdpStream
Required Methods§
sourcefn split(&mut self) -> (Self::ReaderRef<'_>, Self::WriterRef<'_>)
fn split(&mut self) -> (Self::ReaderRef<'_>, Self::WriterRef<'_>)
Splitting the Stream into a read side and a write side is useful in scenarios where you need to use read and write separately.
sourcefn into_inner_stream(self) -> Self::InnerStream
fn into_inner_stream(self) -> Self::InnerStream
Get the internal concrete implementation, note that this operation transfers ownership
sourcefn local_addr(&self) -> Result<SocketAddr, Error>
fn local_addr(&self) -> Result<SocketAddr, Error>
get local address
sourcefn peer_addr(&self) -> Result<SocketAddr, Error>
fn peer_addr(&self) -> Result<SocketAddr, Error>
get peer address
Object Safety§
This trait is not object safe.