pub struct FuturesTupleSet<O, D> { /* private fields */ }Expand description
Represents a list of tuples of a [Future] and an associated piece of data.
Each future must finish within the specified time and the list never outgrows its capacity.
Implementations§
Source§impl<O, D> FuturesTupleSet<O, D>
impl<O, D> FuturesTupleSet<O, D>
Source§impl<O, D> FuturesTupleSet<O, D>where
O: 'static,
impl<O, D> FuturesTupleSet<O, D>where
O: 'static,
Sourcepub fn try_push<F>(
&mut self,
future: F,
data: D,
) -> Result<(), (Pin<Box<dyn AnyFuture<Output = O> + Send>>, D)>where
F: AnyFuture<Output = O>,
pub fn try_push<F>(
&mut self,
future: F,
data: D,
) -> Result<(), (Pin<Box<dyn AnyFuture<Output = O> + Send>>, D)>where
F: AnyFuture<Output = O>,
Push a future into the list.
This method adds the given future to the list. If the length of the list is equal to the capacity, this method returns a error that contains the passed future. In that case, the future 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_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<(Result<O, Timeout>, D)>
Sourcepub fn iter_of_type<T>(&self) -> impl Iterator<Item = (Pin<&T>, &D)>where
T: 'static,
pub fn iter_of_type<T>(&self) -> impl Iterator<Item = (Pin<&T>, &D)>where
T: 'static,
Returns an iterator over all futures of type T pushed via FuturesTupleSet::try_push.
This iterator returns futures in an arbitrary order, which may change.
If downcasting a future 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>, &mut D)>where
T: 'static,
pub fn iter_mut_of_type<T>(
&mut self,
) -> impl Iterator<Item = (Pin<&mut T>, &mut D)>where
T: 'static,
Returns an iterator with mutable access over all futures of type T
pushed via FuturesTupleSet::try_push.
This iterator returns futures in an arbitrary order, which may change.
If downcasting a future to T fails it will be skipped in the iterator.