[−][src]Struct async_std::stream::TakeWhile
pub struct TakeWhile<S, P> { /* fields omitted */ }
A stream that yields elements based on a predicate.
This struct
is created by the take_while
method on Stream
. See its
documentation for more.
Trait Implementations
impl<S: Debug, P: Debug> Debug for TakeWhile<S, P>
[src][+]
fn fmt(&self, f: &mut Formatter) -> Result
[src][−]
Formats the value using the given formatter. Read more
impl<S, P> Stream for TakeWhile<S, P> where
S: Stream,
P: FnMut(&S::Item) -> bool,
[src][+]
S: Stream,
P: FnMut(&S::Item) -> bool,
type Item = S::Item
The type of items yielded by this stream. Read more
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>>
[src][−]
Attempts to receive the next item from the stream. Read more
fn next(&mut self) -> ImplFuture<Option<Self::Item>> where
Self: Unpin,
[src][−]
Self: Unpin,
Advances the stream and returns the next value. Read more
fn take(self, n: usize) -> Take<Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a stream that yields its first n
elements. Read more
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
[src][−]
Self: Sized,
P: FnMut(&Self::Item) -> bool,
Creates a stream that yields elements based on a predicate. Read more
fn throttle(self, d: Duration) -> Throttle<Self> where
Self: Sized,
[src][−]
Self: Sized,
unstable
only.Limit the amount of items yielded per timeslice in a stream. Read more
fn step_by(self, step: usize) -> StepBy<Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a stream that yields each step
th element. Read more
fn chain<U>(self, other: U) -> Chain<Self, U> where
Self: Sized,
U: Stream<Item = Self::Item> + Sized,
[src][−]
Self: Sized,
U: Stream<Item = Self::Item> + Sized,
Takes two streams and creates a new stream over both in sequence. Read more
fn cloned<'a, T>(self) -> Cloned<Self> where
Self: Sized + Stream<Item = &'a T>,
T: Clone + 'a,
[src][−]
Self: Sized + Stream<Item = &'a T>,
T: Clone + 'a,
Creates an stream which copies all of its elements. Read more
fn copied<'a, T>(self) -> Copied<Self> where
Self: Sized + Stream<Item = &'a T>,
T: Copy + 'a,
[src][−]
Self: Sized + Stream<Item = &'a T>,
T: Copy + 'a,
Creates an stream which copies all of its elements. Read more
fn cycle(self) -> Cycle<Self> where
Self: Clone + Sized,
[src][−]
Self: Clone + Sized,
Creates a stream that yields the provided values infinitely and in order. Read more
fn enumerate(self) -> Enumerate<Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a stream that gives the current element's count as well as the next value. Read more
fn delay(self, dur: Duration) -> Delay<Self> where
Self: Sized,
[src][−]
Self: Sized,
unstable
only.Creates a stream that is delayed before it starts yielding items. Read more
fn map<B, F>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> B,
[src][−]
Self: Sized,
F: FnMut(Self::Item) -> B,
Takes a closure and creates a stream that calls that closure on every element of this stream. Read more
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Self::Item),
[src][−]
Self: Sized,
F: FnMut(&Self::Item),
A combinator that does something with each element in the stream, passing the value on. Read more
fn last(self) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
[src][−]
Self: Sized,
Returns the last element of the stream. Read more
fn fuse(self) -> Fuse<Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a stream which ends after the first None
. Read more
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
[src][−]
Self: Sized,
P: FnMut(&Self::Item) -> bool,
Creates a stream that uses a predicate to determine if an element should be yielded. Read more
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
Self: Sized,
U: IntoStream,
F: FnMut(Self::Item) -> U,
[src][−]
Self: Sized,
U: IntoStream,
F: FnMut(Self::Item) -> U,
unstable
only.Creates an stream that works like map, but flattens nested structure. Read more
fn flatten(self) -> Flatten<Self> where
Self: Sized,
Self::Item: IntoStream,
[src][−]
Self: Sized,
Self::Item: IntoStream,
unstable
only.Creates an stream that flattens nested structure. Read more
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
[src][−]
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
Both filters and maps a stream. Read more
fn min_by_key<B, F>(self, key_by: F) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
B: Ord,
F: FnMut(&Self::Item) -> B,
[src][−]
Self: Sized,
B: Ord,
F: FnMut(&Self::Item) -> B,
Returns the element that gives the minimum value with respect to the specified key function. If several elements are equally minimum, the first element is returned. If the stream is empty, None
is returned. Read more
fn max_by_key<B, F>(self, key_by: F) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
B: Ord,
F: FnMut(&Self::Item) -> B,
[src][−]
Self: Sized,
B: Ord,
F: FnMut(&Self::Item) -> B,
Returns the element that gives the maximum value with respect to the specified key function. If several elements are equally maximum, the first element is returned. If the stream is empty, None
is returned. Read more
fn min_by<F>(self, compare: F) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
[src][−]
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
Returns the element that gives the minimum value with respect to the specified comparison function. If several elements are equally minimum, the first element is returned. If the stream is empty, None
is returned. Read more
fn max<F>(self) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
[src][−]
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
Returns the element that gives the maximum value. If several elements are equally maximum, the first element is returned. If the stream is empty, None
is returned. Read more
fn min<F>(self) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
[src][−]
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
Returns the element that gives the minimum value. If several elements are equally minimum, the first element is returned. If the stream is empty, None
is returned. Read more
fn max_by<F>(self, compare: F) -> ImplFuture<Option<Self::Item>> where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
[src][−]
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
Returns the element that gives the maximum value with respect to the specified comparison function. If several elements are equally maximum, the first element is returned. If the stream is empty, None
is returned. Read more
fn nth(&mut self, n: usize) -> ImplFuture<Option<Self::Item>> where
Self: Unpin + Sized,
[src][−]
Self: Unpin + Sized,
Returns the nth element of the stream. Read more
fn all<F>(&mut self, f: F) -> ImplFuture<bool> where
Self: Unpin + Sized,
F: FnMut(Self::Item) -> bool,
[src][−]
Self: Unpin + Sized,
F: FnMut(Self::Item) -> bool,
Tests if every element of the stream matches a predicate. Read more
fn find<P>(&mut self, p: P) -> ImplFuture<Option<Self::Item>> where
Self: Unpin + Sized,
P: FnMut(&Self::Item) -> bool,
[src][−]
Self: Unpin + Sized,
P: FnMut(&Self::Item) -> bool,
Searches for an element in a stream that satisfies a predicate. Read more
fn find_map<F, B>(&mut self, f: F) -> ImplFuture<Option<B>> where
Self: Unpin + Sized,
F: FnMut(Self::Item) -> Option<B>,
[src][−]
Self: Unpin + Sized,
F: FnMut(Self::Item) -> Option<B>,
Applies function to the elements of stream and returns the first non-none result. Read more
fn fold<B, F>(self, init: B, f: F) -> ImplFuture<B> where
Self: Sized,
F: FnMut(B, Self::Item) -> B,
[src][−]
Self: Sized,
F: FnMut(B, Self::Item) -> B,
A combinator that applies a function to every element in a stream producing a single, final value. Read more
fn partition<B, F>(self, f: F) -> ImplFuture<(B, B)> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
B: Default + Extend<Self::Item>,
[src][−]
Self: Sized,
F: FnMut(&Self::Item) -> bool,
B: Default + Extend<Self::Item>,
unstable
only.A combinator that applies a function to every element in a stream creating two collections from it. Read more
fn for_each<F>(self, f: F) -> ImplFuture<()> where
Self: Sized,
F: FnMut(Self::Item),
[src][−]
Self: Sized,
F: FnMut(Self::Item),
Call a closure on each element of the stream. Read more
fn any<F>(&mut self, f: F) -> ImplFuture<bool> where
Self: Unpin + Sized,
F: FnMut(Self::Item) -> bool,
[src][−]
Self: Unpin + Sized,
F: FnMut(Self::Item) -> bool,
Tests if any element of the stream matches a predicate. Read more
fn by_ref(&mut self) -> &mut Self
[src][−]
unstable
only.Borrows an stream, rather than consuming it. Read more
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>,
[src][−]
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Option<B>,
A stream adaptor similar to [fold
] that holds internal state and produces a new stream. Read more
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
[src][−]
Self: Sized,
P: FnMut(&Self::Item) -> bool,
Combinator that skip
s elements based on a predicate. Read more
fn skip(self, n: usize) -> Skip<Self> where
Self: Sized,
[src][−]
Self: Sized,
Creates a combinator that skips the first n
elements. Read more
fn timeout(self, dur: Duration) -> Timeout<Self> where
Self: Stream + Sized,
[src][−]
Self: Stream + Sized,
unstable
only.Await a stream or times out after a duration of time. Read more
fn try_fold<B, F, T, E>(&mut self, init: T, f: F) -> ImplFuture<Result<T, E>> where
Self: Unpin + Sized,
F: FnMut(B, Self::Item) -> Result<T, E>,
[src][−]
Self: Unpin + Sized,
F: FnMut(B, Self::Item) -> Result<T, E>,
A combinator that applies a function as long as it returns successfully, producing a single, final value. Immediately returns the error when the function returns unsuccessfully. Read more
fn try_for_each<F, E>(&mut self, f: F) -> ImplFuture<E> where
Self: Unpin + Sized,
F: FnMut(Self::Item) -> Result<(), E>,
[src][−]
Self: Unpin + Sized,
F: FnMut(Self::Item) -> Result<(), E>,
Applies a falliable function to each element in a stream, stopping at first error and returning it. Read more
fn zip<U>(self, other: U) -> Zip<Self, U> where
Self: Sized,
U: Stream,
[src][−]
Self: Sized,
U: Stream,
'Zips up' two streams into a single stream of pairs. Read more
fn unzip<A, B, FromA, FromB>(self) -> ImplFuture<(FromA, FromB)> where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)> + Sized,
[src][−]
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)> + Sized,
unstable
only.Converts an stream of pairs into a pair of containers. Read more
fn collect<'a, B>(self) -> ImplFuture<B> where
Self: Sized + 'a,
B: FromStream<Self::Item>,
[src][−]
Self: Sized + 'a,
B: FromStream<Self::Item>,
unstable
only.Transforms a stream into a collection. Read more
fn merge<U>(self, other: U) -> Merge<Self, U> where
Self: Sized,
U: Stream<Item = Self::Item> + Sized,
[src][−]
Self: Sized,
U: Stream<Item = Self::Item> + Sized,
unstable
only.Combines multiple streams into a single stream of all their outputs. Read more
fn partial_cmp<S>(self, other: S) -> ImplFuture<Option<Ordering>> where
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
[src][−]
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
Lexicographically compares the elements of this Stream
with those of another. Read more
fn position<P>(&mut self, predicate: P) -> ImplFuture<Option<usize>> where
Self: Unpin + Sized,
P: FnMut(Self::Item) -> bool,
[src][−]
Self: Unpin + Sized,
P: FnMut(Self::Item) -> bool,
Searches for an element in a Stream that satisfies a predicate, returning its index. Read more
fn cmp<S>(self, other: S) -> ImplFuture<Ordering> where
Self: Sized + Stream,
S: Stream,
Self::Item: Ord,
[src][−]
Self: Sized + Stream,
S: Stream,
Self::Item: Ord,
Lexicographically compares the elements of this Stream
with those of another using 'Ord'. Read more
fn count(self) -> ImplFuture<usize> where
Self: Sized,
[src][−]
Self: Sized,
unstable
only.Counts the number of elements in the stream. Read more
fn ne<S>(self, other: S) -> ImplFuture<bool> where
Self: Sized,
S: Sized + Stream,
Self::Item: PartialEq<S::Item>,
[src][−]
Self: Sized,
S: Sized + Stream,
Self::Item: PartialEq<S::Item>,
Determines if the elements of this Stream
are lexicographically not equal to those of another. Read more
fn ge<S>(self, other: S) -> ImplFuture<bool> where
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
[src][−]
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
Determines if the elements of this Stream
are lexicographically greater than or equal to those of another. Read more
fn eq<S>(self, other: S) -> ImplFuture<bool> where
Self: Sized + Stream,
S: Sized + Stream,
Self::Item: PartialEq<S::Item>,
[src][−]
Self: Sized + Stream,
S: Sized + Stream,
Self::Item: PartialEq<S::Item>,
Determines if the elements of this Stream
are lexicographically equal to those of another. Read more
fn gt<S>(self, other: S) -> ImplFuture<bool> where
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
[src][−]
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
Determines if the elements of this Stream
are lexicographically greater than those of another. Read more
fn le<S>(self, other: S) -> ImplFuture<bool> where
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
[src][−]
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
Determines if the elements of this Stream
are lexicographically less or equal to those of another. Read more
fn lt<S>(self, other: S) -> ImplFuture<bool> where
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
[src][−]
Self: Sized + Stream,
S: Stream,
Self::Item: PartialOrd<S::Item>,
Determines if the elements of this Stream
are lexicographically less than those of another. Read more
fn sum<'a, S>(self) -> ImplFuture<S> where
Self: Sized + Stream<Item = S> + 'a,
S: Sum<Self::Item>,
[src][−]
Self: Sized + Stream<Item = S> + 'a,
S: Sum<Self::Item>,
unstable
only.Sums the elements of a stream. Read more
fn product<'a, P>(self) -> ImplFuture<P> where
Self: Sized + Stream<Item = P> + 'a,
P: Product,
[src][−]
Self: Sized + Stream<Item = P> + 'a,
P: Product,
unstable
only.Multiplies all elements of the stream. Read more
impl<'__pin, S, P> Unpin for TakeWhile<S, P> where
__Origin<'__pin, S, P>: Unpin,
[src]
__Origin<'__pin, S, P>: Unpin,
Auto Trait Implementations
impl<S, P> RefUnwindSafe for TakeWhile<S, P> where
P: RefUnwindSafe,
S: RefUnwindSafe,
P: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, P> Send for TakeWhile<S, P> where
P: Send,
S: Send,
P: Send,
S: Send,
impl<S, P> Sync for TakeWhile<S, P> where
P: Sync,
S: Sync,
P: Sync,
S: Sync,
impl<S, P> UnwindSafe for TakeWhile<S, P> where
P: UnwindSafe,
S: UnwindSafe,
P: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
[src][−]
Gets the TypeId
of self
. Read more
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
fn borrow(&self) -> &T
[src][−]
Immutably borrows from an owned value. Read more
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src][−]
Mutably borrows from an owned value. Read more
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src][−]
Performs the conversion.
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,