Crate multi_producer_sink [] [src]

This crate provides wrappers around sinks that allow multiple, independent tasks to write to the same underlying sink.

MPS uses reference counting: You create a new MPS, which consumes a sink. This MPS can then be cheaply cloned, and each one can be used to write to the same, underlying sink.

OwnerMPS consumes a sink, and has a method to obtain Handles to it. These Handles can be used to write to the owner's sink, but they can not outlive it.

Structs

Handle

A handle for using a sink, with static lifetime checking.

MPS

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.

OwnerMPS

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.