Trait Sink

Source
pub trait Sink<Item> {
    type Error;

    // Required methods
    fn send(
        &mut self,
        item: Item,
    ) -> impl Future<Output = Result<(), Self::Error>>;
    fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>>;
    fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>>;
}
Expand description

A Sink is a value into which other values can be sent in pure async/await.

Required Associated Types§

Source

type Error

The type of value produced by the sink when an error occurs.

Required Methods§

Source

fn send(&mut self, item: Item) -> impl Future<Output = Result<(), Self::Error>>

Send item.

Source

fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>>

Flush any remaining output from this sink.

Source

fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>>

Flush any remaining output and close this sink, if necessary.

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.

Implementations on Foreign Types§

Source§

impl<T, S: ?Sized + Sink<T>> Sink<T> for &mut S

Source§

type Error = <S as Sink<T>>::Error

Source§

fn send(&mut self, item: T) -> impl Future<Output = Result<(), Self::Error>>

Source§

fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>>

Source§

fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>>

Implementors§