pub struct BiMultiMapStreams<L: Clone + Hash + Eq, R: Clone + Hash + Eq, St: Stream + Unpin> { /* private fields */ }Expand description
This is a BiMultiMap structure that associates (LeftKey, RightKey) pairs with a stream. Bi - This is a two-way mapping; each kind of key is mapped to keys of the other kind (and streams) Multi - Each key can have associations with multiple keys of the other kind.
The result is a structure that can be indexed with either a left key or a right key to obtain a set of keys of the other kind, and a set of streams, or can be indexed with a (left, right) key pair to obtain at most one stream.
Implementations§
Source§impl<L: Clone + Hash + Eq, R: Clone + Hash + Eq, St: Stream + Unpin> BiMultiMapStreams<L, R, St>
impl<L: Clone + Hash + Eq, R: Clone + Hash + Eq, St: Stream + Unpin> BiMultiMapStreams<L, R, St>
Sourcepub fn insert(&mut self, left: L, right: R, stream: St) -> bool
pub fn insert(&mut self, left: L, right: R, stream: St) -> bool
Insert a new (left, right, stream) associations. Returns true if another stream was not removed to make room for the provided stream.
Sourcepub fn insert_pin(&mut self, left: L, right: R, stream: St) -> Option<St>where
St: Unpin,
pub fn insert_pin(&mut self, left: L, right: R, stream: St) -> Option<St>where
St: Unpin,
Insert a new (left, right, stream) associations. Returns Some(fut) if a stream was evicted to make room for this association.
Sourcepub fn contains(&self, left: &L, right: &R) -> bool
pub fn contains(&self, left: &L, right: &R) -> bool
Check if there exists a (left, right) association.
Sourcepub fn contains_left(&self, left: &L) -> bool
pub fn contains_left(&self, left: &L) -> bool
Check if there exists any associations with the provided left key.
Sourcepub fn contains_right(&self, right: &R) -> bool
pub fn contains_right(&self, right: &R) -> bool
Check if there exists any associations with the provided right key.
Sourcepub fn remove(&mut self, left: &L, right: &R) -> Option<St>where
St: Unpin,
pub fn remove(&mut self, left: &L, right: &R) -> Option<St>where
St: Unpin,
Remove and return the corresponding stream, if one exists.
Sourcepub fn cancel(&mut self, left: &L, right: &R) -> bool
pub fn cancel(&mut self, left: &L, right: &R) -> bool
Remove and drop the corresponding stream. Returns true if a stream was cancelled.
Sourcepub fn get_mut(&mut self, left: &L, right: &R) -> Option<StMut<'_, (L, R), St>>where
St: Unpin,
pub fn get_mut(&mut self, left: &L, right: &R) -> Option<StMut<'_, (L, R), St>>where
St: Unpin,
Get a mutable reference to the corresponding stream.
Sourcepub fn get_right_mut<'a>(&'a mut self, left: &L) -> RightIterMut<'a, L, R, St>where
St: Unpin,
pub fn get_right_mut<'a>(&'a mut self, left: &L) -> RightIterMut<'a, L, R, St>where
St: Unpin,
Get an iterator of mutable references to the streams and right keys that are associated with the provided left key.
Sourcepub fn get_left_mut<'a>(&'a mut self, right: &R) -> LeftIterMut<'a, L, R, St>where
St: Unpin,
pub fn get_left_mut<'a>(&'a mut self, right: &R) -> LeftIterMut<'a, L, R, St>where
St: Unpin,
Get an iterator of mutable references to the streams and left keys that are associated with the provided right key.
Sourcepub fn left_cancel(&mut self, left: &L) -> Vec<R>
pub fn left_cancel(&mut self, left: &L) -> Vec<R>
Remove and drop all streams corresponding to the provided left key. Returns the right keys of all streams that were dropped.
Sourcepub fn right_cancel(&mut self, right: &R) -> Vec<L>
pub fn right_cancel(&mut self, right: &R) -> Vec<L>
Remove and drop all streams corresponding to the provided right key. Returns the left keys of all streams that were dropped.
Sourcepub fn left_remove(&mut self, left: &L) -> Vec<(R, St)>where
St: Unpin,
pub fn left_remove(&mut self, left: &L) -> Vec<(R, St)>where
St: Unpin,
Remove and return the corresponding streams and their right keys.
Sourcepub fn right_remove(&mut self, right: &R) -> Vec<(L, St)>where
St: Unpin,
pub fn right_remove(&mut self, right: &R) -> Vec<(L, St)>where
St: Unpin,
Remove and return the corresponding streams and their left keys.
Sourcepub fn collect_keys(&mut self) -> Vec<(L, R)>
pub fn collect_keys(&mut self) -> Vec<(L, R)>
Returns a vector of all the (left, right) associations contained in the structure (not including the streams).
Trait Implementations§
Source§impl<L: Clone + Hash + Eq, R: Clone + Hash + Eq, St: Stream + Unpin> Stream for BiMultiMapStreams<L, R, St>
impl<L: Clone + Hash + Eq, R: Clone + Hash + Eq, St: Stream + Unpin> Stream for BiMultiMapStreams<L, R, St>
Auto Trait Implementations§
impl<L, R, St> !Freeze for BiMultiMapStreams<L, R, St>
impl<L, R, St> !RefUnwindSafe for BiMultiMapStreams<L, R, St>
impl<L, R, St> Send for BiMultiMapStreams<L, R, St>
impl<L, R, St> Sync for BiMultiMapStreams<L, R, St>
impl<L, R, St> Unpin for BiMultiMapStreams<L, R, St>
impl<L, R, St> !UnwindSafe for BiMultiMapStreams<L, R, St>
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 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.