pub struct FuturesUnordered<F> { /* private fields */ }Expand description
A set of Futures which may complete in any order.
This structure is optimized to manage a large number of futures.
Futures managed by FuturesUnordered will only be polled when they
generate notifications. This reduces the required amount of work needed to
poll large numbers of futures.
FuturesUnordered can be filled by collecting an iterator of Futures
into a FuturesUnordered, or by pushing Futures onto an existing
FuturesUnordered. When new Futures are added, poll_next must be
called in order to begin receiving wakeups for new Futures.
Note that you can create a ready-made FuturesUnordered via the
futures_unordered function in the stream module, or you can start with an
empty set with the FuturesUnordered::new constructor.
Implementations§
Source§impl<T> FuturesUnordered<T>where
T: Future,
impl<T> FuturesUnordered<T>where
T: Future,
Sourcepub fn new() -> FuturesUnordered<T>
pub fn new() -> FuturesUnordered<T>
Constructs a new, empty FuturesUnordered
The returned FuturesUnordered does not contain any futures and, in this
state, FuturesUnordered::poll_next will return Ok(Async::Ready(None)).
Source§impl<T> FuturesUnordered<T>
impl<T> FuturesUnordered<T>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of futures contained in the set.
This represents the total number of in-flight futures.
Trait Implementations§
Source§impl<T: Debug> Debug for FuturesUnordered<T>
impl<T: Debug> Debug for FuturesUnordered<T>
Source§impl<T> Drop for FuturesUnordered<T>
impl<T> Drop for FuturesUnordered<T>
Source§impl<F: Future> FromIterator<F> for FuturesUnordered<F>
impl<F: Future> FromIterator<F> for FuturesUnordered<F>
Source§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = F>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = F>,
Source§impl<T> Stream for FuturesUnordered<T>where
T: Future,
impl<T> Stream for FuturesUnordered<T>where
T: Future,
impl<T: Send> Send for FuturesUnordered<T>
impl<T: Sync> Sync for FuturesUnordered<T>
Auto Trait Implementations§
impl<F> Freeze for FuturesUnordered<F>
impl<F> !RefUnwindSafe for FuturesUnordered<F>
impl<F> Unpin for FuturesUnordered<F>
impl<F> !UnwindSafe for FuturesUnordered<F>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> StreamExt for T
impl<T> StreamExt for T
Source§fn next(self) -> StreamFuture<Self>where
Self: Sized,
fn next(self) -> StreamFuture<Self>where
Self: Sized,
Future. Read moreSource§fn filter<R, P>(self, pred: P) -> Filter<Self, R, P>
fn filter<R, P>(self, pred: P) -> Filter<Self, R, P>
Source§fn filter_map<R, B, F>(self, f: F) -> FilterMap<Self, R, F>
fn filter_map<R, B, F>(self, f: F) -> FilterMap<Self, R, F>
Source§fn then<U, F>(self, f: F) -> Then<Self, U, F>
fn then<U, F>(self, f: F) -> Then<Self, U, F>
f. Read moreSource§fn and_then<U, F>(self, f: F) -> AndThen<Self, U, F>
fn and_then<U, F>(self, f: F) -> AndThen<Self, U, F>
f. Read moreSource§fn or_else<U, F>(self, f: F) -> OrElse<Self, U, F>
fn or_else<U, F>(self, f: F) -> OrElse<Self, U, F>
f. Read moreSource§fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C>where
Self: Sized,
fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C>where
Self: Sized,
Source§fn concat(self) -> Concat<Self>where
Self: Sized,
Self::Item: Extend<<<Self as Stream>::Item as IntoIterator>::Item> + IntoIterator + Default,
fn concat(self) -> Concat<Self>where
Self: Sized,
Self::Item: Extend<<<Self as Stream>::Item as IntoIterator>::Item> + IntoIterator + Default,
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 flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn skip_while<R, P>(self, pred: P) -> SkipWhile<Self, R, P>
fn skip_while<R, P>(self, pred: P) -> SkipWhile<Self, R, P>
true. Read moreSource§fn take_while<R, P>(self, pred: P) -> TakeWhile<Self, R, P>
fn take_while<R, P>(self, pred: P) -> TakeWhile<Self, R, P>
true. Read moreSource§fn for_each<U, F>(self, f: F) -> ForEach<Self, U, F>
fn for_each<U, F>(self, f: F) -> ForEach<Self, U, F>
Source§fn for_each_concurrent<U, F>(self, f: F) -> ForEachConcurrent<Self, U, F>
fn for_each_concurrent<U, F>(self, f: F) -> ForEachConcurrent<Self, U, F>
for_each but may begin
processing an element while previous elements are still being processed. Read moreSource§fn err_into<E>(self) -> ErrInto<Self, E>
fn err_into<E>(self) -> ErrInto<Self, E>
Into trait. Read moreSource§fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
amt items of the underlying stream. Read moreSource§fn skip(self, amt: u64) -> Skip<Self>where
Self: Sized,
fn skip(self, amt: u64) -> Skip<Self>where
Self: Sized,
amt items of the underlying stream. Read moreSource§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll will never again be called once it has
finished. Read moreSource§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn buffered(self, amt: usize) -> Buffered<Self>
fn buffered(self, amt: usize) -> Buffered<Self>
Source§fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self>
fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self>
Source§fn zip<S>(self, other: S) -> Zip<Self, S>
fn zip<S>(self, other: S) -> Zip<Self, S>
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 select<S>(self, other: S) -> Select<Self, S>
fn select<S>(self, other: S) -> Select<Self, S>
Source§fn forward<S>(self, sink: S) -> Forward<Self, S>
fn forward<S>(self, sink: S) -> Forward<Self, S>
Source§fn split(self) -> (SplitSink<Self>, SplitStream<Self>)
fn split(self) -> (SplitSink<Self>, SplitStream<Self>)
Source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
Source§fn recover<E, F>(self, f: F) -> Recover<Self, E, F>
fn recover<E, F>(self, f: F) -> Recover<Self, E, F>
Option<Self::Item>, such that a None value terminates the stream. Read more