pub(crate) struct FutureVector<R, E, F: Future<Output = Result<R, E>> + Unpin> {
vec: Vec<F>,
}
Expand description
Collect futures and await one or all of them.
Fields§
§vec: Vec<F>
Pending futures.
Implementations§
Source§impl<R, E, F: Future<Output = Result<R, E>> + Unpin> FutureVector<R, E, F>
impl<R, E, F: Future<Output = Result<R, E>> + Unpin> FutureVector<R, E, F>
Sourcepub fn select(&mut self) -> FutureVectorSelect<'_, R, E, F> ⓘ
pub fn select(&mut self) -> FutureVectorSelect<'_, R, E, F> ⓘ
Await any one future.
Return the result of the first future that becomes ready, removing it from the vector.
Functionally, behaves like:
ⓘ
async fn select(&mut self) -> Result<R, E>;
Sourcepub fn discarding_join(&mut self) -> FutureVectorDiscardingJoin<'_, R, E, F> ⓘ
pub fn discarding_join(&mut self) -> FutureVectorDiscardingJoin<'_, R, E, F> ⓘ
Join all futures, discarding successful results.
If an error occurs, return it immediately. All pending futures remain.
Functionally, behaves like:
ⓘ
async fn discarding_join(&mut self) -> Result<(), E>;
Auto Trait Implementations§
impl<R, E, F> Freeze for FutureVector<R, E, F>
impl<R, E, F> RefUnwindSafe for FutureVector<R, E, F>where
F: RefUnwindSafe,
impl<R, E, F> Send for FutureVector<R, E, F>where
F: Send,
impl<R, E, F> Sync for FutureVector<R, E, F>where
F: Sync,
impl<R, E, F> Unpin for FutureVector<R, E, F>
impl<R, E, F> UnwindSafe for FutureVector<R, E, F>where
F: UnwindSafe,
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
Mutably borrows from an owned value. Read more