Struct multi_producer_sink::SyncMPS
[−]
[src]
pub struct SyncMPS<S: Sink> { /* fields omitted */ }
A multi producer sink (SyncMPS
). 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 close
d and emitted via the Done
.
Trait Implementations
impl<S: Sink> Drop for SyncMPS<S>
[src]
Performs minimal cleanup to allow for correct closing behaviour
impl<S: Sink> Clone for SyncMPS<S>
[src]
fn clone(&self) -> SyncMPS<S>
[src]
Returns a new handle to the same underlying sink.
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: Sink> Sink for SyncMPS<S>
[src]
type SinkItem = S::SinkItem
The type of value that the sink accepts.
type SinkError = ()
The type of value produced by the sink when an error occurs.
fn poll_ready(&mut self, cx: &mut Context) -> Poll<(), Self::SinkError>
[src]
Attempts to prepare the Sink
to receive a value. Read more
fn start_send(&mut self, item: S::SinkItem) -> Result<(), Self::SinkError>
[src]
Begin the process of sending a value to the sink. Each call to this function must be proceeded by a successful call to poll_ready
which returned Ok(Async::Ready(()))
. Read more
fn poll_flush(&mut self, cx: &mut Context) -> Poll<(), Self::SinkError>
[src]
Flush any remaining output from this sink. Read more
fn poll_close(&mut self, cx: &mut Context) -> Poll<(), Self::SinkError>
[src]
This only delegates to the poll_close
method of the inner sink if all other
active handles have already called close. Else, it simply flushes the
underlying sink, but does not close it.
Calling clone
after calling close
leads to ambiguity whether the
inner sink has actually closed yet. It's still safe, but not advisable.