Trait tokio_socks::io::AsyncSocket

source ·
pub trait AsyncSocket {
    // Required methods
    fn poll_read(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &mut [u8],
    ) -> Poll<Result<usize, Error>>;
    fn poll_write(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &[u8],
    ) -> Poll<Result<usize, Error>>;
}
Expand description

A trait for asynchronous socket I/O.

Any type that implements tokio’s AsyncRead and AsyncWrite traits has implemented AsyncSocket trait.

Use FuturesIoCompatExt to wrap futures-io types as AsyncSocket types.

Required Methods§

source

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

source

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

Implementors§

source§

impl<S> AsyncSocket for S
where S: AsyncRead + AsyncWrite,