Trait SplitAfter

Source
pub trait SplitAfter<'a, T: 'a, P> {
    // Required method
    fn split_after(&self, predicate: P) -> SplitInc<'a, T, P> ;
}
Expand description

SplitAfter trait returns an iterator splitting a slice after a predicate and including the matched item at the end of each set (if existing). For example:

use slice_ext::*;
 
let a: &[u8] = &[0, 1, 2]; 
let mut s = (&a[..]).split_after(|v| *v == 1 );
 
assert_eq!(s.next().unwrap(), &[0, 1]);
assert_eq!(s.next().unwrap(), &[2]);
assert_eq!(s.next().is_none(), true);
 

Required Methods§

Source

fn split_after(&self, predicate: P) -> SplitInc<'a, T, P>

Implementations on Foreign Types§

Source§

impl<'a, T, P> SplitAfter<'a, T, P> for &'a [T]
where P: FnMut(&T) -> bool, T: Debug + 'a,

Source§

fn split_after(&self, predicate: P) -> SplitInc<'a, T, P>

Implementors§