pub trait TcpStream:
AsyncRead
+ AsyncWrite
+ Debug
+ Send {
// Required methods
fn poll_write_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>;
fn poll_read_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>;
fn take_error(&self) -> Result<Option<Error>>;
fn local_addr(&self) -> Result<SocketAddr>;
fn peer_addr(&self) -> Result<SocketAddr>;
fn shutdown(&self, how: Shutdown) -> Result<()>;
}
Expand description
A TcpStream for this Runtime
Required Methods§
Sourcefn poll_write_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>
fn poll_write_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<()>>
Check if the stream can be written to.
Sourcefn poll_read_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>
fn poll_read_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<()>>
Check if the stream can be read from.
Sourcefn take_error(&self) -> Result<Option<Error>>
fn take_error(&self) -> Result<Option<Error>>
Check if any socket errors exist on the TcpStream
.
Checking for socket errors is fallible, which is why the outer type is
Result
.
Sourcefn local_addr(&self) -> Result<SocketAddr>
fn local_addr(&self) -> Result<SocketAddr>
Returns the local address that this stream is connected to.
Sourcefn peer_addr(&self) -> Result<SocketAddr>
fn peer_addr(&self) -> Result<SocketAddr>
Returns the remote address that this stream is connected to.