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.