Trait multi_producer_sink::MPS [] [src]

pub trait MPS<S: Sink>: Clone + Sink {
    type Done: Future<Item = S, Error = (S::SinkError, S)>;
    fn mps(sink: S) -> (Self, Self::Done);
}

A multi producer sink (MPS). This is a cloneable handle to a single sink of type S, and each handle can be used to write to the inner sink.

An error is signaled via the Done, the sink methods themselves only return Err(()). Upon encountering an error, all handles are notified and they return Err(()). All further polling will always yield Err(None) as well.

Unless an error occured, each of the handles must invoke close before being dropped. The inner sink is closed when each of the handles has closed and emitted via the Done.

Associated Types

A future that signals when the wrapped sink is done.

Yields back the wrapped sink in an Ok when the last handle is closed or dropped. Emits the first error and the wrapped sink as an Err if the sink errors.

Required Methods

Create a new MPS from a sink and a Done to notify when it is done.

Implementors