pub struct StreamSet<O> { /* private fields */ }Expand description
Represents a set of [Stream]s.
Each stream must finish within the specified time and the list never outgrows its capacity.
Implementations§
Source§impl<O> StreamSet<O>where
O: Send + 'static,
impl<O> StreamSet<O>where
O: Send + 'static,
Sourcepub fn try_push<F>(
&mut self,
stream: F,
) -> Result<(), Pin<Box<dyn AnyStream<Item = O> + Send>>>where
F: AnyStream<Item = O>,
pub fn try_push<F>(
&mut self,
stream: F,
) -> Result<(), Pin<Box<dyn AnyStream<Item = O> + Send>>>where
F: AnyStream<Item = O>,
Push a stream into the list.
This method adds the given stream to the list. If the length of the list is equal to the capacity, this method returns a error that contains the passed stream. In that case, the stream is not added to the set.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn poll_ready_unpin(&mut self, cx: &mut Context<'_>) -> Poll<()>
pub fn poll_next_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<O, Timeout>>>
Sourcepub fn iter_of_type<T>(&self) -> impl Iterator<Item = Pin<&T>>where
T: 'static,
pub fn iter_of_type<T>(&self) -> impl Iterator<Item = Pin<&T>>where
T: 'static,
Returns an iterator over all streams of type T pushed via StreamSet::try_push.
This iterator returns streams in an arbitrary order, which may change.
If downcasting a stream to T fails it will be skipped in the iterator.
Sourcepub fn iter_mut_of_type<T>(&mut self) -> impl Iterator<Item = Pin<&mut T>>where
T: 'static,
pub fn iter_mut_of_type<T>(&mut self) -> impl Iterator<Item = Pin<&mut T>>where
T: 'static,
Returns an iterator with mutable access over all streams of type T
pushed via StreamSet::try_push.
This iterator returns streams in an arbitrary order, which may change.
If downcasting a stream to T fails it will be skipped in the iterator.