pub struct StreamMap<K, S> { /* private fields */ }Expand description
Combining multiple streams into one, with each stream having a unique key.
Implementations§
Source§impl<K, T> StreamMap<K, T>
impl<K, T> StreamMap<K, T>
Sourcepub fn insert(&mut self, key: K, stream: T) -> bool
pub fn insert(&mut self, key: K, stream: T) -> bool
Insert a stream into the map with a unique key. The function will return true if the map does not have the key present, otherwise it will return false
Sourcepub fn set_wake_on_success(&mut self, key: &K, wake_on_success: bool) -> bool
pub fn set_wake_on_success(&mut self, key: &K, wake_on_success: bool) -> bool
Mark stream with assigned key to wake up on successful yield. Will return false if stream does not exist or if value is the same as previously set.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&K, &T)>
pub fn iter(&self) -> impl Iterator<Item = (&K, &T)>
An iterator visiting all key-value pairs in arbitrary order.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut T)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut T)>
An iterator visiting all key-value pairs mutably in arbitrary order.
Sourcepub fn iter_pin(&mut self) -> impl Iterator<Item = (&K, Pin<&mut T>)>
pub fn iter_pin(&mut self) -> impl Iterator<Item = (&K, Pin<&mut T>)>
An iterator visiting all key-value pairs with a pinned valued in arbitrary order
Sourcepub fn keys(&self) -> impl Iterator<Item = &K>
pub fn keys(&self) -> impl Iterator<Item = &K>
Returns an iterator visiting all keys in arbitrary order.
Sourcepub fn values(&self) -> impl Iterator<Item = &T>
pub fn values(&self) -> impl Iterator<Item = &T>
An iterator visiting all values in arbitrary order.
Sourcepub fn values_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut T>
An iterator visiting all values mutably in arbitrary order.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Returns true if the map contains a stream for the specified key.
Sourcepub fn get(&self, key: &K) -> Option<&T>
pub fn get(&self, key: &K) -> Option<&T>
Returns a reference to the stream corresponding to the key.
Sourcepub fn get_mut(&mut self, key: &K) -> Option<&mut T>
pub fn get_mut(&mut self, key: &K) -> Option<&mut T>
Returns a mutable stream to the value corresponding to the key.
Sourcepub fn get_mut_or_default(&mut self, key: &K) -> &mut Twhere
T: Default,
pub fn get_mut_or_default(&mut self, key: &K) -> &mut Twhere
T: Default,
Returns a muable stream or default value if it does not exist.
Sourcepub fn get_pinned(&mut self, key: &K) -> Option<Pin<&mut T>>
pub fn get_pinned(&mut self, key: &K) -> Option<Pin<&mut T>>
Returns a pinned stream corresponding to the key.
Trait Implementations§
Source§impl<K, T> FromIterator<(K, T)> for StreamMap<K, T>
impl<K, T> FromIterator<(K, T)> for StreamMap<K, T>
Source§impl<K, T> FusedStream for StreamMap<K, T>
impl<K, T> FusedStream for StreamMap<K, T>
Source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true if the stream should no longer be polled.Source§impl<K, T> Stream for StreamMap<K, T>
impl<K, T> Stream for StreamMap<K, T>
Auto Trait Implementations§
impl<K, S> !Freeze for StreamMap<K, S>
impl<K, S> !RefUnwindSafe for StreamMap<K, S>
impl<K, S> Send for StreamMap<K, S>
impl<K, S> Sync for StreamMap<K, S>
impl<K, S> Unpin for StreamMap<K, S>
impl<K, S> !UnwindSafe for StreamMap<K, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> StreamExt for T
impl<T> StreamExt for T
Source§fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
Source§fn into_future(self) -> StreamFuture<Self>
fn into_future(self) -> StreamFuture<Self>
Source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
Source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
Source§fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
Source§fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
Source§fn collect<C>(self) -> Collect<Self, C>
fn collect<C>(self) -> Collect<Self, C>
Source§fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB>
fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB>
Source§fn concat(self) -> Concat<Self>
fn concat(self) -> Concat<Self>
Source§fn count(self) -> Count<Self>where
Self: Sized,
fn count(self) -> Count<Self>where
Self: Sized,
Source§fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>
Source§fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F>
fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F>
true if any element in stream satisfied a predicate. Read moreSource§fn all<Fut, F>(self, f: F) -> All<Self, Fut, F>
fn all<Fut, F>(self, f: F) -> All<Self, Fut, F>
true if all element in stream satisfied a predicate. Read moreSource§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_unordered(
self,
limit: impl Into<Option<usize>>,
) -> FlattenUnorderedWithFlowController<Self, ()>
fn flatten_unordered( self, limit: impl Into<Option<usize>>, ) -> FlattenUnorderedWithFlowController<Self, ()>
Source§fn flat_map_unordered<U, F>(
self,
limit: impl Into<Option<usize>>,
f: F,
) -> FlatMapUnordered<Self, U, F>
fn flat_map_unordered<U, F>( self, limit: impl Into<Option<usize>>, f: F, ) -> FlatMapUnordered<Self, U, F>
StreamExt::map but flattens nested Streams
and polls them concurrently, yielding items in any order, as they made
available. Read moreSource§fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>
fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>
StreamExt::fold that holds internal state
and produces a new stream. Read moreSource§fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>
true. Read moreSource§fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>
true. Read moreSource§fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>
fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>
Source§fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F>
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F>
Source§fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F,
) -> ForEachConcurrent<Self, Fut, F>
fn for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F, ) -> ForEachConcurrent<Self, Fut, F>
Source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n items of the underlying stream. Read moreSource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n items of the underlying stream. Read moreSource§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where
Self: Sized + 'a,
Source§fn buffered(self, n: usize) -> Buffered<Self>
fn buffered(self, n: usize) -> Buffered<Self>
Source§fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
Source§fn zip<St>(self, other: St) -> Zip<Self, St>
fn zip<St>(self, other: St) -> Zip<Self, St>
Source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
peek method. Read moreSource§fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
Source§fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
Source§fn forward<S>(self, sink: S) -> Forward<Self, S>
fn forward<S>(self, sink: S) -> Forward<Self, S>
Source§fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
Source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn left_stream<B>(self) -> Either<Self, B>
fn left_stream<B>(self) -> Either<Self, B>
Source§fn right_stream<B>(self) -> Either<B, Self>
fn right_stream<B>(self) -> Either<B, Self>
Source§fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
Stream::poll_next on Unpin
stream types.