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)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
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
Creates a value from an iterator. Read more
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
Returns true
if the stream should no longer be polled.
sourceimpl<'a, St: Stream + Unpin> IntoIterator for &'a SelectAll<St>
impl<'a, St: Stream + Unpin> IntoIterator for &'a SelectAll<St>
sourceimpl<'a, St: Stream + Unpin> IntoIterator for &'a mut SelectAll<St>
impl<'a, St: Stream + Unpin> IntoIterator for &'a mut SelectAll<St>
sourceimpl<St: Stream + Unpin> IntoIterator for SelectAll<St>
impl<St: Stream + Unpin> IntoIterator for SelectAll<St>
sourceimpl<St: Stream + Unpin> Stream for SelectAll<St>
impl<St: Stream + Unpin> Stream for SelectAll<St>
impl<'__pin, St> Unpin for SelectAll<St> where
__Origin<'__pin, St>: Unpin,
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> !UnwindSafe for SelectAll<St>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more