Skip to main content

Sink

Trait Sink 

Source
pub trait Sink:
    Sync
    + Send
    + 'static {
    // Required method
    fn send(
        &mut self,
        bufs: impl Into<IoBufs> + Send,
    ) -> impl Future<Output = Result<(), Error>> + Send;
}
Expand description

Interface that any runtime must implement to send messages over a network connection.

Required Methods§

Source

fn send( &mut self, bufs: impl Into<IoBufs> + Send, ) -> impl Future<Output = Result<(), Error>> + Send

Send a message to the sink.

§Warning

If the sink returns an error, part of the message may still be delivered. After any error, the sink is no longer reusable and subsequent sends will return Error::Closed.

Dropping the future (e.g. via select!) also poisons the sink, since a partial write may have occurred.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§