Skip to main content

AsyncTcpStreamWrite

Trait AsyncTcpStreamWrite 

Source
pub trait AsyncTcpStreamWrite:
    Send
    + Sync
    + Debug {
    // Required methods
    fn local_addr(&self) -> Result<SocketAddr>;
    fn remote_addr(&self) -> Result<SocketAddr>;
    fn poll_write(
        &mut self,
        cx: &mut Context<'_>,
        buf: &[u8],
    ) -> Poll<Result<usize>>;
    fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>;
    fn poll_shutdown(
        &mut self,
        cx: &mut Context<'_>,
        how: Shutdown,
    ) -> Poll<Result<()>>;
}
Expand description

Trait for writing to a Tcp connection.

Required Methods§

Source

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

Return the local bound address of a socket.

Source

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

Return the local bound address of a socket.

Source

fn poll_write( &mut self, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>

Poll for writing data to the Tcp connection.

Source

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

Poll for flush completion.

Source

fn poll_shutdown( &mut self, cx: &mut Context<'_>, how: Shutdown, ) -> Poll<Result<()>>

Poll for shutdown completion.

Implementations on Foreign Types§

Source§

impl AsyncTcpStreamWrite for TcpStream

Available on crate feature runtime-smol only.
Source§

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

Source§

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

Source§

fn poll_write( &mut self, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>

Source§

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

Source§

fn poll_shutdown( &mut self, cx: &mut Context<'_>, how: Shutdown, ) -> Poll<Result<()>>

Source§

impl AsyncTcpStreamWrite for OwnedWriteHalf

Available on crate feature runtime-tokio only.
Source§

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

Source§

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

Source§

fn poll_write( &mut self, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>

Source§

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

Source§

fn poll_shutdown( &mut self, cx: &mut Context<'_>, _how: Shutdown, ) -> Poll<Result<()>>

Implementors§