pub fn drop_while<T, F, Fut>(s: RS2Stream<T>, predicate: F) -> RS2Stream<T>Expand description
Skip elements from a stream while a predicate returns true
This combinator skips elements from the stream as long as the predicate returns true. Once the predicate returns false, it yields that element and all remaining elements.
ยงExamples
use rs2_stream::rs2::*;
use futures_util::stream::StreamExt;
let stream = from_iter(vec![1, 2, 3, 4, 5]);
let result = drop_while(stream, |&x| async move { x < 4 }).collect::<Vec<_>>().await;
assert_eq!(result, vec![4, 5]);