Struct multi_consumer_stream::MCSHandle
[−]
[src]
pub struct MCSHandle<S: Stream, Key: Eq + Hash + Copy, ItemFn, ErrFn> { /* fields omitted */ }
A stream that receives all items/errors for which the corresponding MCS
's item_fn
/err_fn
return the key from which the MCSHandle
was constructed.
Methods
impl<S, Key, ItemFn, ErrFn> MCSHandle<S, Key, ItemFn, ErrFn> where
S: Stream,
Key: Eq + Hash + Copy,
[src]
S: Stream,
Key: Eq + Hash + Copy,
pub fn mcs_handle(&self, key: Key) -> MCSHandle<S, Key, ItemFn, ErrFn>
[src]
Create a MCSHandle
to the underlying stream. The handle receives all items for which the
corresponding 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.
pub fn try_mcs_handle(
&self,
key: Key
) -> Option<MCSHandle<S, Key, ItemFn, ErrFn>>
[src]
&self,
key: Key
) -> Option<MCSHandle<S, Key, ItemFn, ErrFn>>
Create a MCSHandle
to the underlying stream. The handle receives all items for which the
corresponding 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> Drop for MCSHandle<S, Key, ItemFn, ErrFn> where
S: Stream,
Key: Eq + Hash + Copy,
[src]
S: Stream,
Key: Eq + Hash + Copy,
impl<S, Key, ItemFn, ErrFn> Stream for MCSHandle<S, Key, ItemFn, ErrFn> where
S: Stream,
Key: Eq + Hash + Copy,
ItemFn: Fn(&S::Item) -> Key,
ErrFn: Fn(&S::Error) -> Key,
[src]
S: Stream,
Key: Eq + Hash + Copy,
ItemFn: Fn(&S::Item) -> Key,
ErrFn: Fn(&S::Error) -> Key,
type Item = S::Item
Values yielded by the stream.
type Error = S::Error
Errors yielded by the stream.
fn poll_next(
&mut self,
cx: &mut Context
) -> Poll<Option<Self::Item>, Self::Error>
[src]
&mut self,
cx: &mut Context
) -> Poll<Option<Self::Item>, Self::Error>
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