runtime_raw

Trait TcpStream

Source
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§

Source

fn poll_write_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<()>>

Check if the stream can be written to.

Source

fn poll_read_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<()>>

Check if the stream can be read from.

Source

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.

Source

fn local_addr(&self) -> Result<SocketAddr>

Returns the local address that this stream is connected to.

Source

fn peer_addr(&self) -> Result<SocketAddr>

Returns the remote address that this stream is connected to.

Source

fn shutdown(&self, how: Shutdown) -> Result<()>

Shuts down the read, write, or both halves of this connection.

Implementors§