Struct multi_producer_sink::OwnerMPS
[−]
[src]
pub struct OwnerMPS<S>(_);
A multiple producer sink (MPS) that works via lifetimes rather than reference
counting. This wraps a sink, and allows to obtain handles which can write to
the inner sink. These handles can not outlive the OwnerMPS
.
Errors are simply propagated to the handle that triggered it, but they are not stored. This means that other handles might still try to write to the sink after it errored. Make sure to use a sink that can deal with this.
Each of the handles must invoke close
before being dropped. The inner sink
is closed when each of the handles has close
d.
If more flexibility regarding the lifetimes is needed, MPS
provides an
alternative based on reference counting (which creates a runtime overhead).
Methods
impl<S> OwnerMPS<S>
[src]
fn new(sink: S) -> OwnerMPS<S>
[src]
Create a new OwnerMPS
, wrapping the given sink.
fn into_inner(self) -> S
[src]
Consume the OwnerMPS
and return ownership of the inner sink.
The only way of closing the inner sink is by using this method and then
calling close
on the sink itself.
fn handle(&self) -> Handle<S>
[src]
Create a new handle to the underlying sink. This handle implements the
Sink
trait and delegates to the inner sink. It can however not close
the inner sink.