Skip to main content

Socket

Trait Socket 

Source
pub trait Socket: Send + 'static {
    // Required methods
    fn read(&mut self) -> impl Future<Output = Option<Bytes>> + Send;
    fn write(
        &mut self,
        buffer: &[u8],
    ) -> impl Future<Output = Result<()>> + Send;
    fn close(&mut self) -> impl Future<Output = ()> + Send;
}

Required Methods§

Source

fn read(&mut self) -> impl Future<Output = Option<Bytes>> + Send

Source

fn write(&mut self, buffer: &[u8]) -> impl Future<Output = Result<()>> + Send

Source

fn close(&mut self) -> impl Future<Output = ()> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§