Struct futures_util::stream::select_all::SelectAll
source · [−]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
sourceimpl<St: Stream + Unpin> SelectAll<St>
impl<St: Stream + Unpin> SelectAll<St>
sourcepub fn new() -> Self
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)
.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of streams contained in the set.
This represents the total number of in-flight streams.
sourcepub fn push(&mut self, stream: St)
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.
sourcepub fn iter(&self) -> Iter<'_, St>ⓘNotable traits for Iter<'a, St>impl<'a, St: Stream + Unpin> Iterator for Iter<'a, St> type Item = &'a St;
pub fn iter(&self) -> Iter<'_, St>ⓘNotable traits for Iter<'a, St>impl<'a, St: Stream + Unpin> Iterator for Iter<'a, St> type Item = &'a St;
Returns an iterator that allows inspecting each stream in the set.
Trait Implementations
sourceimpl<St: Stream + Unpin> Extend<St> for SelectAll<St>
impl<St: Stream + Unpin> Extend<St> for SelectAll<St>
sourcefn extend<T: IntoIterator<Item = St>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = St>>(&mut self, iter: T)
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)sourceimpl<St: Stream + Unpin> FromIterator<St> for SelectAll<St>
impl<St: Stream + Unpin> FromIterator<St> for SelectAll<St>
sourcefn from_iter<T: IntoIterator<Item = St>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = St>>(iter: T) -> Self
sourceimpl<St: Stream + Unpin> FusedStream for SelectAll<St>
impl<St: Stream + Unpin> FusedStream for SelectAll<St>
sourcefn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true
if the stream should no longer be polled.