iroh_blobs::util::sink

Trait Sink

Source
pub trait Sink<Item> {
    type Error;

    // Required method
    fn send(
        &mut self,
        value: Item,
    ) -> impl Future<Output = Result<(), Self::Error>>;

    // Provided methods
    fn with_map_err<F, U>(self, f: F) -> WithMapErr<Self, F>
       where Self: Sized,
             F: Fn(Self::Error) -> U + Send + 'static { ... }
    fn with_map<F, U>(self, f: F) -> WithMap<Self, F>
       where Self: Sized,
             F: Fn(U) -> Item + Send + 'static { ... }
}
Expand description

Our version of a sink, that can be mapped etc.

Required Associated Types§

Required Methods§

Source

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

Provided Methods§

Source

fn with_map_err<F, U>(self, f: F) -> WithMapErr<Self, F>
where Self: Sized, F: Fn(Self::Error) -> U + Send + 'static,

Source

fn with_map<F, U>(self, f: F) -> WithMap<Self, F>
where Self: Sized, F: Fn(U) -> Item + Send + 'static,

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<I, T> Sink<T> for &mut I
where I: Sink<T>,

Source§

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

Source§

async fn send(&mut self, value: T) -> Result<(), Self::Error>

Implementors§

Source§

impl<'a, T> Sink<T> for IrpcSenderRefSink<'a, T>
where T: RpcMessage,

Source§

type Error = SendError

Source§

impl<P, F, E, U> Sink<U> for WithMapErr<P, F>
where P: Sink<U>, F: Fn(P::Error) -> E + Send + 'static,

Source§

type Error = E

Source§

impl<P, F, T, U> Sink<T> for WithMap<P, F>
where P: Sink<U>, F: Fn(T) -> U + Send + 'static,

Source§

type Error = <P as Sink<U>>::Error

Source§

impl<T> Sink<T> for Drain

Source§

impl<T> Sink<T> for IrpcSenderSink<T>
where T: RpcMessage,

Source§

type Error = SendError

Source§

impl<T> Sink<T> for TokioMpscSenderSink<T>

Source§

type Error = SendError<T>