pub fn take_while<T, S, P>(predicate: P, s: S) -> impl Stream<Item = T>Expand description
Takes values from a stream while the predicate returns true.
§Note
Prefer using the built-in StreamExt::take_while() method when chaining:
ⓘ
use futures::StreamExt;
let result = stream.take_while(|x| futures::future::ready(*x < 5));This standalone function is provided for functional/pipe-style composition.