Struct futures_util::stream::Zip
source · pub struct Zip<St1: Stream, St2: Stream> { /* private fields */ }
Expand description
Stream for the zip
method.
Implementations§
source§impl<St1: Stream, St2: Stream> Zip<St1, St2>
impl<St1: Stream, St2: Stream> Zip<St1, St2>
sourcepub fn get_ref(&self) -> (&St1, &St2)
pub fn get_ref(&self) -> (&St1, &St2)
Acquires a reference to the underlying streams that this combinator is pulling from.
sourcepub fn get_mut(&mut self) -> (&mut St1, &mut St2)
pub fn get_mut(&mut self) -> (&mut St1, &mut St2)
Acquires a mutable reference to the underlying streams that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the stream which may otherwise confuse this combinator.
sourcepub fn get_pin_mut(self: Pin<&mut Self>) -> (Pin<&mut St1>, Pin<&mut St2>)
pub fn get_pin_mut(self: Pin<&mut Self>) -> (Pin<&mut St1>, Pin<&mut St2>)
Acquires a pinned mutable reference to the underlying streams that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the stream which may otherwise confuse this combinator.
sourcepub fn into_inner(self) -> (St1, St2)
pub fn into_inner(self) -> (St1, St2)
Consumes this combinator, returning the underlying streams.
Note that this may discard intermediate state of this combinator, so care should be taken to avoid losing resources when this is called.
Trait Implementations§
source§impl<St1: Debug + Stream, St2: Debug + Stream> Debug for Zip<St1, St2>where
St1::Item: Debug,
St2::Item: Debug,
impl<St1: Debug + Stream, St2: Debug + Stream> Debug for Zip<St1, St2>where St1::Item: Debug, St2::Item: Debug,
source§impl<St1, St2> FusedStream for Zip<St1, St2>where
St1: Stream,
St2: Stream,
impl<St1, St2> FusedStream for Zip<St1, St2>where St1: Stream, St2: Stream,
source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
Returns
true
if the stream should no longer be polled.source§impl<St1, St2> Stream for Zip<St1, St2>where
St1: Stream,
St2: Stream,
impl<St1, St2> Stream for Zip<St1, St2>where St1: Stream, St2: Stream,
impl<'__pin, St1: Stream, St2: Stream> Unpin for Zip<St1, St2>where __Origin<'__pin, St1, St2>: Unpin,
Auto Trait Implementations§
impl<St1, St2> RefUnwindSafe for Zip<St1, St2>where St1: RefUnwindSafe, St2: RefUnwindSafe, <St1 as Stream>::Item: RefUnwindSafe, <St2 as Stream>::Item: RefUnwindSafe,
impl<St1, St2> Send for Zip<St1, St2>where St1: Send, St2: Send, <St1 as Stream>::Item: Send, <St2 as Stream>::Item: Send,
impl<St1, St2> Sync for Zip<St1, St2>where St1: Sync, St2: Sync, <St1 as Stream>::Item: Sync, <St2 as Stream>::Item: Sync,
impl<St1, St2> UnwindSafe for Zip<St1, St2>where St1: UnwindSafe, St2: UnwindSafe, <St1 as Stream>::Item: UnwindSafe, <St2 as Stream>::Item: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<T> StreamExt for Twhere
T: Stream + ?Sized,
impl<T> StreamExt for Twhere T: Stream + ?Sized,
source§fn next(&mut self) -> Next<'_, Self> ⓘwhere
Self: Unpin,
fn next(&mut self) -> Next<'_, Self> ⓘwhere Self: Unpin,
Creates a future that resolves to the next item in the stream. Read more
source§fn into_future(self) -> StreamFuture<Self> ⓘwhere
Self: Sized + Unpin,
fn into_future(self) -> StreamFuture<Self> ⓘwhere Self: Sized + Unpin,
source§fn map<T, F>(self, f: F) -> Map<Self, F>where
F: FnMut(Self::Item) -> T,
Self: Sized,
fn map<T, F>(self, f: F) -> Map<Self, F>where F: FnMut(Self::Item) -> T, Self: Sized,
Maps this stream’s items to a different type, returning a new stream of
the resulting type. Read more
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where Self: Sized,
Creates a stream which gives the current iteration count as well as
the next value. Read more
source§fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
Filters the values produced by this stream according to the provided
asynchronous predicate. Read more
source§fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = Option<T>>,
Self: Sized,
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = Option<T>>, Self: Sized,
Filters the values produced by this stream while simultaneously mapping
them to a different type according to the provided asynchronous closure. Read more
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where
F: FnMut(Self::Item) -> Fut,
Fut: Future,
Self: Sized,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future, Self: Sized,
Computes from this stream’s items new items of a different type using
an asynchronous closure. Read more
source§fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C> ⓘwhere
Self: Sized,
fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C> ⓘwhere Self: Sized,
Transforms a stream into a collection, returning a
future representing the result of that computation. Read more
source§fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB> ⓘwhere
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Sized + Stream<Item = (A, B)>,
fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB> ⓘwhere FromA: Default + Extend<A>, FromB: Default + Extend<B>, Self: Sized + Stream<Item = (A, B)>,
Converts a stream of pairs into a future, which
resolves to pair of containers. Read more
source§fn concat(self) -> Concat<Self> ⓘwhere
Self: Sized,
Self::Item: Extend<<<Self as Stream>::Item as IntoIterator>::Item> + IntoIterator + Default,
fn concat(self) -> Concat<Self> ⓘwhere Self: Sized, Self::Item: Extend<<<Self as Stream>::Item as IntoIterator>::Item> + IntoIterator + Default,
Concatenate all items of a stream into a single extendable
destination, returning a future representing the end result. Read more
source§fn count(self) -> Count<Self> ⓘwhere
Self: Sized,
fn count(self) -> Count<Self> ⓘwhere Self: Sized,
Drives the stream to completion, counting the number of items. Read more
source§fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> ⓘwhere
F: FnMut(T, Self::Item) -> Fut,
Fut: Future<Output = T>,
Self: Sized,
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> ⓘwhere F: FnMut(T, Self::Item) -> Fut, Fut: Future<Output = T>, Self: Sized,
Execute an accumulating asynchronous computation over a stream,
collecting all the values into one final result. Read more
source§fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
Execute predicate over asynchronous stream, and return
true
if any element in stream satisfied a predicate. Read moresource§fn all<Fut, F>(self, f: F) -> All<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn all<Fut, F>(self, f: F) -> All<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
Execute predicate over asynchronous stream, and return
true
if all element in stream satisfied a predicate. Read moresource§fn flatten(self) -> Flatten<Self>where
Self::Item: Stream,
Self: Sized,
fn flatten(self) -> Flatten<Self>where Self::Item: Stream, Self: Sized,
Flattens a stream of streams into just one continuous stream. Read more
source§fn flatten_unordered(
self,
limit: impl Into<Option<usize>>
) -> FlattenUnordered<Self>where
Self::Item: Stream + Unpin,
Self: Sized,
fn flatten_unordered( self, limit: impl Into<Option<usize>> ) -> FlattenUnordered<Self>where Self::Item: Stream + Unpin, Self: Sized,
Flattens a stream of streams into just one continuous stream. Polls
inner streams produced by the base stream concurrently. Read more
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where
F: FnMut(Self::Item) -> U,
U: Stream,
Self: Sized,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where F: FnMut(Self::Item) -> U, U: Stream, Self: Sized,
source§fn flat_map_unordered<U, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> FlatMapUnordered<Self, U, F>where
U: Stream + Unpin,
F: FnMut(Self::Item) -> U,
Self: Sized,
fn flat_map_unordered<U, F>( self, limit: impl Into<Option<usize>>, f: F ) -> FlatMapUnordered<Self, U, F>where U: Stream + Unpin, F: FnMut(Self::Item) -> U, Self: Sized,
Maps a stream like
StreamExt::map
but flattens nested Stream
s
and polls them concurrently, yielding items in any order, as they made
available. Read moresource§fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>where
F: FnMut(&mut S, Self::Item) -> Fut,
Fut: Future<Output = Option<B>>,
Self: Sized,
fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>where F: FnMut(&mut S, Self::Item) -> Fut, Fut: Future<Output = Option<B>>, Self: Sized,
Combinator similar to
StreamExt::fold
that holds internal state
and produces a new stream. Read moresource§fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
Skip elements on this stream while the provided asynchronous predicate
resolves to
true
. Read moresource§fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
Self: Sized,
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,
Take elements from this stream while the provided asynchronous predicate
resolves to
true
. Read moresource§fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>where
Fut: Future,
Self: Sized,
fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>where Fut: Future, Self: Sized,
Take elements from this stream until the provided future resolves. Read more
source§fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
Self: Sized,
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = ()>, Self: Sized,
Runs this stream to completion, executing the provided asynchronous
closure for each element on the stream. Read more
source§fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> ⓘwhere
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
Self: Sized,
fn for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F ) -> ForEachConcurrent<Self, Fut, F> ⓘwhere F: FnMut(Self::Item) -> Fut, Fut: Future<Output = ()>, Self: Sized,
Runs this stream to completion, executing the provided asynchronous
closure for each element on the stream concurrently as elements become
available. Read more
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where Self: Sized,
Creates a new stream of at most
n
items of the underlying stream. Read moresource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where Self: Sized,
Creates a new stream which skips
n
items of the underlying stream. Read moresource§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where Self: Sized + UnwindSafe,
Catches unwinding panics while polling the stream. Read more
source§fn boxed<'a>(self) -> BoxStream<'a, Self::Item>where
Self: Sized + Send + 'a,
fn boxed<'a>(self) -> BoxStream<'a, Self::Item>where Self: Sized + Send + 'a,
Wrap the stream in a Box, pinning it. Read more
source§fn boxed_local<'a>(self) -> LocalBoxStream<'a, Self::Item>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> LocalBoxStream<'a, Self::Item>where Self: Sized + 'a,
Wrap the stream in a Box, pinning it. Read more
source§fn buffered(self, n: usize) -> Buffered<Self>where
Self::Item: Future,
Self: Sized,
fn buffered(self, n: usize) -> Buffered<Self>where Self::Item: Future, Self: Sized,
An adaptor for creating a buffered list of pending futures. Read more
source§fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>where
Self::Item: Future,
Self: Sized,
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>where Self::Item: Future, Self: Sized,
An adaptor for creating a buffered list of pending futures (unordered). Read more
source§fn zip<St>(self, other: St) -> Zip<Self, St>where
St: Stream,
Self: Sized,
fn zip<St>(self, other: St) -> Zip<Self, St>where St: Stream, Self: Sized,
An adapter for zipping two streams together. Read more
source§fn chain<St>(self, other: St) -> Chain<Self, St>where
St: Stream<Item = Self::Item>,
Self: Sized,
fn chain<St>(self, other: St) -> Chain<Self, St>where St: Stream<Item = Self::Item>, Self: Sized,
Adapter for chaining two streams. Read more
source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where Self: Sized,
Creates a new stream which exposes a
peek
method. Read moresource§fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
fn chunks(self, capacity: usize) -> Chunks<Self>where Self: Sized,
An adaptor for chunking up items of the stream inside a vector. Read more
source§fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where Self: Sized,
An adaptor for chunking up ready items of the stream inside a vector. Read more
source§fn forward<S>(self, sink: S) -> Forward<Self, S> ⓘwhere
S: Sink<Self::Ok, Error = Self::Error>,
Self: TryStream + Sized,
fn forward<S>(self, sink: S) -> Forward<Self, S> ⓘwhere S: Sink<Self::Ok, Error = Self::Error>, Self: TryStream + Sized,
A future that completes after the given stream has been fully processed
into the sink and the sink has been flushed and closed. Read more
source§fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)where
Self: Sink<Item> + Sized,
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)where Self: Sink<Item> + Sized,
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnMut(&Self::Item),
Self: Sized,
fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: FnMut(&Self::Item), Self: Sized,
Do something with each item of this stream, afterwards passing it on. Read more
source§fn right_stream<B>(self) -> Either<B, Self> ⓘwhere
B: Stream<Item = Self::Item>,
Self: Sized,
fn right_stream<B>(self) -> Either<B, Self> ⓘwhere B: Stream<Item = Self::Item>, Self: Sized,
source§fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where Self: Unpin,
A convenience method for calling
Stream::poll_next
on Unpin
stream types.