Struct multi_consumer_stream::MCS [] [src]

pub struct MCS<S: Stream, Key: Eq + Hash + Copy, ItemFn, ErrFn>(_);

Wraps a stream and provides a multi-consumer-stream.

This structs allows to create new MCSHandle, which receive all the items/errors for which the ItemFn/ErrFn compute a certain key. All items/errors for which no corresponding MCSHandle exist are routed to the primary MCS.

Methods

impl<S, Key, ItemFn, ErrFn> MCS<S, Key, ItemFn, ErrFn> where
    S: Stream,
    Key: Eq + Hash + Copy
[src]

[src]

Create a new MCS with the given functions to compute keys.

impl<S, Key, ItemFn, ErrFn> MCS<S, Key, ItemFn, ErrFn> where
    S: Stream,
    Key: Eq + Hash + Copy,
    ItemFn: Fn(&S::Item) -> Key,
    ErrFn: Fn(&S::Error) -> Key, 
[src]

[src]

Consume the MCS and retrieve ownership of the wrapped stream.

Polling an MCSHandle after consuming its MCS panics.

[src]

Create a MCSHandle to the underlying stream. The handle receives all items for which the MCS's item_fn returns key, and all errors for which the MCS's error_fn returns key.

Panics if there is already a handle for that key.

[src]

Create a MCSHandle to the underlying stream. The handle receives all items for which the MCS's item_fn returns key, and all errors for which the MCS's error_fn returns key.

This returns None if there is already a handle for that key.

Trait Implementations

impl<S, Key, ItemFn, ErrFn> Stream for MCS<S, Key, ItemFn, ErrFn> where
    S: Stream,
    Key: Copy + Eq + Hash,
    ItemFn: Fn(&S::Item) -> Key,
    ErrFn: Fn(&S::Error) -> Key, 
[src]

Values yielded by the stream.

Errors yielded by the stream.

[src]

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more

Auto Trait Implementations

impl<S, Key, ItemFn, ErrFn> !Send for MCS<S, Key, ItemFn, ErrFn>

impl<S, Key, ItemFn, ErrFn> !Sync for MCS<S, Key, ItemFn, ErrFn>