Crate multi_consumer_stream [] [src]

This crate provides a wrapper around streams that allow multiple, independent tasks to read from the same underlying stream. Each handle is assigned a key, and each received item is given to a function to compute a key, determining which handle receives the item. There is always default handle which receives an item if the result of the key function does not match any other handle.

Structs

DefaultHandle

A DefaultHandle to an OwnerMCS, receiving all items for which the owner's key_fn return a key not associated with the any KeyHandle.

KeyHandle

A KeyHandle to an OwnerMCS, receiving only the items for which the owner's key_fn return the key associated with the KeyHandle.

OwnerMCS

A wrapper around a stream, that allows obtaining multiple handles for reading from that stream.