pub struct FuturesUnordered<F> { /* private fields */ }
Expand description
A set of Future
s 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 collect
ing an iterator of Future
s
into a FuturesUnordered
, or by push
ing Future
s onto an existing
FuturesUnordered
. When new Future
s are added, poll_next
must be
called in order to begin receiving wakeups for new Future
s.
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 for FuturesUnordered<T>where
T: Debug,
impl<T> Debug for FuturesUnordered<T>where
T: Debug,
Source§impl<T> Drop for FuturesUnordered<T>
impl<T> Drop for FuturesUnordered<T>
Source§impl<F> FromIterator<F> for FuturesUnordered<F>where
F: Future,
impl<F> FromIterator<F> for FuturesUnordered<F>where
F: Future,
Source§fn from_iter<T>(iter: T) -> FuturesUnordered<F>where
T: IntoIterator<Item = F>,
fn from_iter<T>(iter: T) -> FuturesUnordered<F>where
T: IntoIterator<Item = F>,
Source§impl<T> Stream for FuturesUnordered<T>where
T: Future,
impl<T> Stream for FuturesUnordered<T>where
T: Future,
Source§fn poll_next(
&mut self,
cx: &mut Context<'_>,
) -> Result<Async<Option<<T as Future>::Item>>, <T as Future>::Error>
fn poll_next( &mut self, cx: &mut Context<'_>, ) -> Result<Async<Option<<T as Future>::Item>>, <T as Future>::Error>
None
if the stream is exhausted. Read moreimpl<T> Send for FuturesUnordered<T>where
T: Send,
impl<T> Sync for FuturesUnordered<T>where
T: Sync,
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>(self) -> Collect<Self, C>
fn collect<C>(self) -> Collect<Self, C>
Source§fn concat(self) -> Concat<Self>
fn concat(self) -> Concat<Self>
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