Struct futures_lite::stream::Then
source · [−]pub struct Then<S, F, Fut> { /* private fields */ }
Expand description
Stream for the StreamExt::then()
method.
Trait Implementations
sourceimpl<S, F, Fut> Stream for Then<S, F, Fut> where
S: Stream,
F: FnMut(S::Item) -> Fut,
Fut: Future,
impl<S, F, Fut> Stream for Then<S, F, Fut> where
S: Stream,
F: FnMut(S::Item) -> Fut,
Fut: Future,
impl<'__pin, S, F, Fut> Unpin for Then<S, F, Fut> where
__Origin<'__pin, S, F, Fut>: Unpin,
Auto Trait Implementations
impl<S, F, Fut> RefUnwindSafe for Then<S, F, Fut> where
F: RefUnwindSafe,
Fut: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, F, Fut> Send for Then<S, F, Fut> where
F: Send,
Fut: Send,
S: Send,
impl<S, F, Fut> Sync for Then<S, F, Fut> where
F: Sync,
Fut: Sync,
S: Sync,
impl<S, F, Fut> UnwindSafe for Then<S, F, Fut> where
F: UnwindSafe,
Fut: UnwindSafe,
S: UnwindSafe,
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
sourceimpl<S> StreamExt for S where
S: Stream + ?Sized,
impl<S> StreamExt for S where
S: Stream + ?Sized,
sourcefn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> where
Self: Unpin,
fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> where
Self: Unpin,
A convenience for calling Stream::poll_next()
on !
Unpin
types.
sourcefn next(&mut self) -> NextFuture<'_, Self>ⓘNotable traits for NextFuture<'_, S>impl<S: Stream + Unpin + ?Sized> Future for NextFuture<'_, S> type Output = Option<S::Item>;
where
Self: Unpin,
fn next(&mut self) -> NextFuture<'_, Self>ⓘNotable traits for NextFuture<'_, S>impl<S: Stream + Unpin + ?Sized> Future for NextFuture<'_, S> type Output = Option<S::Item>;
where
Self: Unpin,
Retrieves the next item in the stream. Read more
sourcefn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self>ⓘNotable traits for TryNextFuture<'_, S>impl<T, E, S> Future for TryNextFuture<'_, S> where
S: Stream<Item = Result<T, E>> + Unpin + ?Sized, type Output = Result<Option<T>, E>;
where
Self: Stream<Item = Result<T, E>> + Unpin,
fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self>ⓘNotable traits for TryNextFuture<'_, S>impl<T, E, S> Future for TryNextFuture<'_, S> where
S: Stream<Item = Result<T, E>> + Unpin + ?Sized, type Output = Result<Option<T>, E>;
where
Self: Stream<Item = Result<T, E>> + Unpin,
S: Stream<Item = Result<T, E>> + Unpin + ?Sized, type Output = Result<Option<T>, E>;
Retrieves the next item in the stream. Read more
sourcefn count(self) -> CountFuture<Self>ⓘNotable traits for CountFuture<S>impl<S: Stream + ?Sized> Future for CountFuture<S> type Output = usize;
where
Self: Sized,
fn count(self) -> CountFuture<Self>ⓘNotable traits for CountFuture<S>impl<S: Stream + ?Sized> Future for CountFuture<S> type Output = usize;
where
Self: Sized,
Counts the number of items in the stream. Read more
sourcefn map<T, F>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> T,
fn map<T, F>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> T,
Maps items of the stream to new values using a closure. Read more
sourcefn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
Self: Sized,
U: Stream,
F: FnMut(Self::Item) -> U,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
Self: Sized,
U: Stream,
F: FnMut(Self::Item) -> U,
Maps items to streams and then concatenates them. Read more
sourcefn flatten(self) -> Flatten<Self> where
Self: Sized,
Self::Item: Stream,
fn flatten(self) -> Flatten<Self> where
Self: Sized,
Self::Item: Stream,
Concatenates inner streams. Read more
sourcefn then<F, Fut>(self, f: F) -> Then<Self, F, Fut> where
Self: Sized,
F: FnMut(Self::Item) -> Fut,
Fut: Future,
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut> where
Self: Sized,
F: FnMut(Self::Item) -> Fut,
Fut: Future,
Maps items of the stream to new values using an async closure. Read more
sourcefn filter<P>(self, predicate: P) -> Filter<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
Keeps items of the stream for which predicate
returns true
. Read more
sourcefn filter_map<T, F>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<T>,
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<T>,
Filters and maps items of the stream using a closure. Read more
sourcefn take(self, n: usize) -> Take<Self> where
Self: Sized,
fn take(self, n: usize) -> Take<Self> where
Self: Sized,
Takes only the first n
items of the stream. Read more
sourcefn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
Takes items while predicate
returns true
. Read more
sourcefn skip(self, n: usize) -> Skip<Self> where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self> where
Self: Sized,
Skips the first n
items of the stream. Read more
sourcefn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
Skips items while predicate
returns true
. Read more
sourcefn step_by(self, step: usize) -> StepBy<Self> where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self> where
Self: Sized,
Yields every step
th item. Read more
sourcefn chain<U>(self, other: U) -> Chain<Self, U> where
Self: Sized,
U: Stream<Item = Self::Item> + Sized,
fn chain<U>(self, other: U) -> Chain<Self, U> where
Self: Sized,
U: Stream<Item = Self::Item> + Sized,
Appends another stream to the end of this one. Read more
sourcefn cloned<'a, T>(self) -> Cloned<Self> where
Self: Stream<Item = &'a T> + Sized,
T: Clone + 'a,
fn cloned<'a, T>(self) -> Cloned<Self> where
Self: Stream<Item = &'a T> + Sized,
T: Clone + 'a,
Clones all items. Read more
sourcefn copied<'a, T>(self) -> Copied<Self> where
Self: Stream<Item = &'a T> + Sized,
T: Copy + 'a,
fn copied<'a, T>(self) -> Copied<Self> where
Self: Stream<Item = &'a T> + Sized,
T: Copy + 'a,
Copies all items. Read more
sourcefn collect<C>(self) -> CollectFuture<Self, C>ⓘNotable traits for CollectFuture<S, C>impl<S, C> Future for CollectFuture<S, C> where
S: Stream,
C: Default + Extend<S::Item>, type Output = C;
where
Self: Sized,
C: Default + Extend<Self::Item>,
fn collect<C>(self) -> CollectFuture<Self, C>ⓘNotable traits for CollectFuture<S, C>impl<S, C> Future for CollectFuture<S, C> where
S: Stream,
C: Default + Extend<S::Item>, type Output = C;
where
Self: Sized,
C: Default + Extend<Self::Item>,
S: Stream,
C: Default + Extend<S::Item>, type Output = C;
Collects all items in the stream into a collection. Read more
sourcefn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C>ⓘNotable traits for TryCollectFuture<S, C>impl<T, E, S, C> Future for TryCollectFuture<S, C> where
S: Stream<Item = Result<T, E>>,
C: Default + Extend<T>, type Output = Result<C, E>;
where
Self: Stream<Item = Result<T, E>> + Sized,
C: Default + Extend<T>,
fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C>ⓘNotable traits for TryCollectFuture<S, C>impl<T, E, S, C> Future for TryCollectFuture<S, C> where
S: Stream<Item = Result<T, E>>,
C: Default + Extend<T>, type Output = Result<C, E>;
where
Self: Stream<Item = Result<T, E>> + Sized,
C: Default + Extend<T>,
S: Stream<Item = Result<T, E>>,
C: Default + Extend<T>, type Output = Result<C, E>;
Collects all items in the fallible stream into a collection. Read more
sourcefn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B>ⓘNotable traits for PartitionFuture<S, P, B>impl<S, P, B> Future for PartitionFuture<S, P, B> where
S: Stream + Sized,
P: FnMut(&S::Item) -> bool,
B: Default + Extend<S::Item>, type Output = (B, B);
where
Self: Sized,
B: Default + Extend<Self::Item>,
P: FnMut(&Self::Item) -> bool,
fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B>ⓘNotable traits for PartitionFuture<S, P, B>impl<S, P, B> Future for PartitionFuture<S, P, B> where
S: Stream + Sized,
P: FnMut(&S::Item) -> bool,
B: Default + Extend<S::Item>, type Output = (B, B);
where
Self: Sized,
B: Default + Extend<Self::Item>,
P: FnMut(&Self::Item) -> bool,
S: Stream + Sized,
P: FnMut(&S::Item) -> bool,
B: Default + Extend<S::Item>, type Output = (B, B);
Partitions items into those for which predicate
is true
and those for which it is
false
, and then collects them into two collections. Read more
sourcefn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T>ⓘNotable traits for FoldFuture<S, F, T>impl<S, F, T> Future for FoldFuture<S, F, T> where
S: Stream,
F: FnMut(T, S::Item) -> T, type Output = T;
where
Self: Sized,
F: FnMut(T, Self::Item) -> T,
fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T>ⓘNotable traits for FoldFuture<S, F, T>impl<S, F, T> Future for FoldFuture<S, F, T> where
S: Stream,
F: FnMut(T, S::Item) -> T, type Output = T;
where
Self: Sized,
F: FnMut(T, Self::Item) -> T,
S: Stream,
F: FnMut(T, S::Item) -> T, type Output = T;
Accumulates a computation over the stream. Read more
sourcefn try_fold<T, E, F, B>(
&mut self,
init: B,
f: F
) -> TryFoldFuture<'_, Self, F, B>ⓘNotable traits for TryFoldFuture<'a, S, F, B>impl<'a, T, E, S, F, B> Future for TryFoldFuture<'a, S, F, B> where
S: Stream<Item = Result<T, E>> + Unpin,
F: FnMut(B, T) -> Result<B, E>, type Output = Result<B, E>;
where
Self: Stream<Item = Result<T, E>> + Unpin + Sized,
F: FnMut(B, T) -> Result<B, E>,
fn try_fold<T, E, F, B>(
&mut self,
init: B,
f: F
) -> TryFoldFuture<'_, Self, F, B>ⓘNotable traits for TryFoldFuture<'a, S, F, B>impl<'a, T, E, S, F, B> Future for TryFoldFuture<'a, S, F, B> where
S: Stream<Item = Result<T, E>> + Unpin,
F: FnMut(B, T) -> Result<B, E>, type Output = Result<B, E>;
where
Self: Stream<Item = Result<T, E>> + Unpin + Sized,
F: FnMut(B, T) -> Result<B, E>,
S: Stream<Item = Result<T, E>> + Unpin,
F: FnMut(B, T) -> Result<B, E>, type Output = Result<B, E>;
Accumulates a fallible computation over the stream. Read more
sourcefn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Option<B>,
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Option<B>,
Maps items of the stream to new values using a state value and a closure. Read more
sourcefn cycle(self) -> Cycle<Self> where
Self: Clone + Sized,
fn cycle(self) -> Cycle<Self> where
Self: Clone + Sized,
Repeats the stream from beginning to end, forever. Read more
sourcefn enumerate(self) -> Enumerate<Self> where
Self: Sized,
fn enumerate(self) -> Enumerate<Self> where
Self: Sized,
Enumerates items, mapping them to (index, item)
. Read more
sourcefn inspect<F>(self, f: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Self::Item),
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Self::Item),
Calls a closure on each item and passes it on. Read more
sourcefn nth(&mut self, n: usize) -> NthFuture<'_, Self>ⓘNotable traits for NthFuture<'a, S>impl<'a, S> Future for NthFuture<'a, S> where
S: Stream + Unpin + ?Sized, type Output = Option<S::Item>;
where
Self: Unpin,
fn nth(&mut self, n: usize) -> NthFuture<'_, Self>ⓘNotable traits for NthFuture<'a, S>impl<'a, S> Future for NthFuture<'a, S> where
S: Stream + Unpin + ?Sized, type Output = Option<S::Item>;
where
Self: Unpin,
S: Stream + Unpin + ?Sized, type Output = Option<S::Item>;
Gets the n
th item of the stream. Read more
sourcefn last(self) -> LastFuture<Self>ⓘNotable traits for LastFuture<S>impl<S: Stream> Future for LastFuture<S> type Output = Option<S::Item>;
where
Self: Sized,
fn last(self) -> LastFuture<Self>ⓘNotable traits for LastFuture<S>impl<S: Stream> Future for LastFuture<S> type Output = Option<S::Item>;
where
Self: Sized,
Returns the last item in the stream. Read more
sourcefn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P>ⓘNotable traits for FindFuture<'a, S, P>impl<'a, S, P> Future for FindFuture<'a, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(&S::Item) -> bool, type Output = Option<S::Item>;
where
Self: Unpin,
P: FnMut(&Self::Item) -> bool,
fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P>ⓘNotable traits for FindFuture<'a, S, P>impl<'a, S, P> Future for FindFuture<'a, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(&S::Item) -> bool, type Output = Option<S::Item>;
where
Self: Unpin,
P: FnMut(&Self::Item) -> bool,
S: Stream + Unpin + ?Sized,
P: FnMut(&S::Item) -> bool, type Output = Option<S::Item>;
Finds the first item of the stream for which predicate
returns true
. Read more
sourcefn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F>ⓘNotable traits for FindMapFuture<'a, S, F>impl<'a, S, B, F> Future for FindMapFuture<'a, S, F> where
S: Stream + Unpin + ?Sized,
F: FnMut(S::Item) -> Option<B>, type Output = Option<B>;
where
Self: Unpin,
F: FnMut(Self::Item) -> Option<B>,
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F>ⓘNotable traits for FindMapFuture<'a, S, F>impl<'a, S, B, F> Future for FindMapFuture<'a, S, F> where
S: Stream + Unpin + ?Sized,
F: FnMut(S::Item) -> Option<B>, type Output = Option<B>;
where
Self: Unpin,
F: FnMut(Self::Item) -> Option<B>,
S: Stream + Unpin + ?Sized,
F: FnMut(S::Item) -> Option<B>, type Output = Option<B>;
sourcefn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P>ⓘNotable traits for PositionFuture<'a, S, P>impl<'a, S, P> Future for PositionFuture<'a, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = Option<usize>;
where
Self: Unpin,
P: FnMut(Self::Item) -> bool,
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P>ⓘNotable traits for PositionFuture<'a, S, P>impl<'a, S, P> Future for PositionFuture<'a, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = Option<usize>;
where
Self: Unpin,
P: FnMut(Self::Item) -> bool,
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = Option<usize>;
Finds the index of the first item of the stream for which predicate
returns true
. Read more
sourcefn all<P>(&mut self, predicate: P) -> AllFuture<'_, Self, P>ⓘNotable traits for AllFuture<'_, S, P>impl<S, P> Future for AllFuture<'_, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = bool;
where
Self: Unpin,
P: FnMut(Self::Item) -> bool,
fn all<P>(&mut self, predicate: P) -> AllFuture<'_, Self, P>ⓘNotable traits for AllFuture<'_, S, P>impl<S, P> Future for AllFuture<'_, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = bool;
where
Self: Unpin,
P: FnMut(Self::Item) -> bool,
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = bool;
Tests if predicate
returns true
for all items in the stream. Read more
sourcefn any<P>(&mut self, predicate: P) -> AnyFuture<'_, Self, P>ⓘNotable traits for AnyFuture<'_, S, P>impl<S, P> Future for AnyFuture<'_, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = bool;
where
Self: Unpin,
P: FnMut(Self::Item) -> bool,
fn any<P>(&mut self, predicate: P) -> AnyFuture<'_, Self, P>ⓘNotable traits for AnyFuture<'_, S, P>impl<S, P> Future for AnyFuture<'_, S, P> where
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = bool;
where
Self: Unpin,
P: FnMut(Self::Item) -> bool,
S: Stream + Unpin + ?Sized,
P: FnMut(S::Item) -> bool, type Output = bool;
Tests if predicate
returns true
for any item in the stream. Read more
sourcefn for_each<F>(self, f: F) -> ForEachFuture<Self, F>ⓘNotable traits for ForEachFuture<S, F>impl<S, F> Future for ForEachFuture<S, F> where
S: Stream,
F: FnMut(S::Item), type Output = ();
where
Self: Sized,
F: FnMut(Self::Item),
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F>ⓘNotable traits for ForEachFuture<S, F>impl<S, F> Future for ForEachFuture<S, F> where
S: Stream,
F: FnMut(S::Item), type Output = ();
where
Self: Sized,
F: FnMut(Self::Item),
S: Stream,
F: FnMut(S::Item), type Output = ();
Calls a closure on each item of the stream. Read more
sourcefn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F>ⓘNotable traits for TryForEachFuture<'a, S, F>impl<'a, S, F, E> Future for TryForEachFuture<'a, S, F> where
S: Stream + Unpin + ?Sized,
F: FnMut(S::Item) -> Result<(), E>, type Output = Result<(), E>;
where
Self: Unpin,
F: FnMut(Self::Item) -> Result<(), E>,
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F>ⓘNotable traits for TryForEachFuture<'a, S, F>impl<'a, S, F, E> Future for TryForEachFuture<'a, S, F> where
S: Stream + Unpin + ?Sized,
F: FnMut(S::Item) -> Result<(), E>, type Output = Result<(), E>;
where
Self: Unpin,
F: FnMut(Self::Item) -> Result<(), E>,
S: Stream + Unpin + ?Sized,
F: FnMut(S::Item) -> Result<(), E>, type Output = Result<(), E>;
Calls a fallible closure on each item of the stream, stopping on first error. Read more
sourcefn zip<U>(self, other: U) -> Zip<Self, U> where
Self: Sized,
U: Stream,
fn zip<U>(self, other: U) -> Zip<Self, U> where
Self: Sized,
U: Stream,
Zips up two streams into a single stream of pairs. Read more
sourcefn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB>ⓘNotable traits for UnzipFuture<S, FromA, FromB>impl<S, A, B, FromA, FromB> Future for UnzipFuture<S, FromA, FromB> where
S: Stream<Item = (A, B)>,
FromA: Default + Extend<A>,
FromB: Default + Extend<B>, type Output = (FromA, FromB);
where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)> + Sized,
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB>ⓘNotable traits for UnzipFuture<S, FromA, FromB>impl<S, A, B, FromA, FromB> Future for UnzipFuture<S, FromA, FromB> where
S: Stream<Item = (A, B)>,
FromA: Default + Extend<A>,
FromB: Default + Extend<B>, type Output = (FromA, FromB);
where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)> + Sized,
S: Stream<Item = (A, B)>,
FromA: Default + Extend<A>,
FromB: Default + Extend<B>, type Output = (FromA, FromB);
Collects a stream of pairs into a pair of collections. Read more
sourcefn or<S>(self, other: S) -> Or<Self, S> where
Self: Sized,
S: Stream<Item = Self::Item>,
fn or<S>(self, other: S) -> Or<Self, S> where
Self: Sized,
S: Stream<Item = Self::Item>,
Merges with other
stream, preferring items from self
whenever both streams are ready. Read more
sourcefn race<S>(self, other: S) -> Race<Self, S> where
Self: Sized,
S: Stream<Item = Self::Item>,
fn race<S>(self, other: S) -> Race<Self, S> where
Self: Sized,
S: Stream<Item = Self::Item>,
Merges with other
stream, with no preference for either stream when both are ready. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more