FutureStream

Struct FutureStream 

Source
pub struct FutureStream<T: Send> { /* private fields */ }
Expand description

Stream of multiple Futures

A FutureStream can be used to wait for multiple Futures, and return them incrementally as they are resolved.

It implements an iterator over completed Futures, and can be constructed from an iterator of Futures.

May be cloned and the clones passed to other threads so that Futures may be added from multiple threads.

Implementations§

Source§

impl<T: Send> FutureStream<T>

Source

pub fn new() -> FutureStream<T>

Source

pub fn add(&self, fut: Future<T>)
where T: 'static,

Add a Future to the stream.

Source

pub fn outstanding(&self) -> usize

Return number of outstanding Futures.

Source

pub fn waiter<'fs>(&'fs self) -> FutureStreamWaiter<'fs, T>

Return a singleton FutureStreamWaiter. If one already exists, block until it is released.

Source

pub fn try_waiter<'fs>(&'fs self) -> Option<FutureStreamWaiter<'fs, T>>

Return a singleton FutureStreamWaiter. Returns None if one already exists.

Source

pub fn poll(&self) -> Option<Future<T>>

Return a resolved Future if any, but don’t wait for more to resolve.

Source

pub fn wait(&self) -> Option<Future<T>>

Return resolved Futures. Blocks if there are outstanding Futures which are not yet resolved. Returns None when there are no more outstanding Futures.

Trait Implementations§

Source§

impl<T: Clone + Send> Clone for FutureStream<T>

Source§

fn clone(&self) -> FutureStream<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Send + 'static> FromIterator<Future<T>> for FutureStream<T>

Source§

fn from_iter<I>(iterator: I) -> Self
where I: IntoIterator<Item = Future<T>>,

Creates a value from an iterator. Read more
Source§

impl<'a, T: Send + 'a> IntoIterator for &'a FutureStream<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = FutureStreamIter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T> Freeze for FutureStream<T>

§

impl<T> RefUnwindSafe for FutureStream<T>

§

impl<T> Send for FutureStream<T>

§

impl<T> Sync for FutureStream<T>

§

impl<T> Unpin for FutureStream<T>

§

impl<T> UnwindSafe for FutureStream<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.