pub trait IteratorExt: Iterator {
// Required method
fn split_when(
self,
predicate: impl Fn(&Self::Item) -> bool,
) -> (impl Iterator<Item = Self::Item>, Self)
where Self: Sized;
}
Required Methods§
Sourcefn split_when(
self,
predicate: impl Fn(&Self::Item) -> bool,
) -> (impl Iterator<Item = Self::Item>, Self)where
Self: Sized,
fn split_when(
self,
predicate: impl Fn(&Self::Item) -> bool,
) -> (impl Iterator<Item = Self::Item>, Self)where
Self: Sized,
Split the iterator into two parts when the predicate first time turns true.
The first part is the part before the predicate is true. The second part is the part after the predicate is true.