pub struct SelectAll<St> { /* private fields */ }
Expand description

An unbounded set of streams

This “combinator” provides the ability to maintain a set of streams and drive them all to completion.

Streams are pushed into this set and their realized values are yielded as they become ready. Streams will only be polled when they generate notifications. This allows to coordinate a large number of streams.

Note that you can create a ready-made SelectAll via the select_all function in the stream module, or you can start with an empty set with the SelectAll::new constructor.

Implementations§

source§

impl<St: Stream + Unpin> SelectAll<St>

source

pub fn new() -> Self

Constructs a new, empty SelectAll

The returned SelectAll does not contain any streams and, in this state, SelectAll::poll will return Poll::Ready(None).

source

pub fn len(&self) -> usize

Returns the number of streams contained in the set.

This represents the total number of in-flight streams.

source

pub fn is_empty(&self) -> bool

Returns true if the set contains no streams

source

pub fn push(&mut self, stream: St)

Push a stream into the set.

This function submits the given stream to the set for managing. This function will not call poll on the submitted stream. The caller must ensure that SelectAll::poll is called in order to receive task notifications.

source

pub fn iter(&self) -> Iter<'_, St>

Returns an iterator that allows inspecting each stream in the set.

source

pub fn iter_mut(&mut self) -> IterMut<'_, St>

Returns an iterator that allows modifying each stream in the set.

source

pub fn clear(&mut self)

Clears the set, removing all streams.

Trait Implementations§

source§

impl<St: Debug> Debug for SelectAll<St>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<St: Stream + Unpin> Default for SelectAll<St>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<St: Stream + Unpin> Extend<St> for SelectAll<St>

source§

fn extend<T: IntoIterator<Item = St>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<St: Stream + Unpin> FromIterator<St> for SelectAll<St>

source§

fn from_iter<T: IntoIterator<Item = St>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<St: Stream + Unpin> FusedStream for SelectAll<St>

source§

fn is_terminated(&self) -> bool

Returns true if the stream should no longer be polled.
source§

impl<'a, St: Stream + Unpin> IntoIterator for &'a SelectAll<St>

§

type Item = &'a St

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, St>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a, St: Stream + Unpin> IntoIterator for &'a mut SelectAll<St>

§

type Item = &'a mut St

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, St>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<St: Stream + Unpin> IntoIterator for SelectAll<St>

§

type Item = St

The type of the elements being iterated over.
§

type IntoIter = IntoIter<St>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<St: Stream + Unpin> Stream for SelectAll<St>

§

type Item = <St as Stream>::Item

Values yielded by the stream.
source§

fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<Self::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more

Auto Trait Implementations§

§

impl<St> !RefUnwindSafe for SelectAll<St>

§

impl<St> Send for SelectAll<St>where St: Send,

§

impl<St> Sync for SelectAll<St>where St: Sync,

§

impl<St> Unpin for SelectAll<St>

§

impl<St> !UnwindSafe for SelectAll<St>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<S, T, E> TryStream for Swhere S: Stream<Item = Result<T, E>> + ?Sized,

§

type Ok = T

The type of successful values yielded by this future
§

type Error = E

The type of failures yielded by this future
source§

fn try_poll_next( self: Pin<&mut S>, cx: &mut Context<'_> ) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>

Poll this TryStream as if it were a Stream. Read more