Struct Split

struct Split<'a, T: 'a, P> { ... }
where
    P: FnMut(&T) -> bool

An iterator over subslices separated by elements that match a predicate function.

This struct is created by the split method on slices.

Example

let slice = [10, 40, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);
assert_eq!(iter.next(), Some(&[10, 40][..]));
assert_eq!(iter.next(), Some(&[20][..]));
assert_eq!(iter.next(), None);

Implementations

impl<'a, T: 'a, P: FnMut(&T) -> bool> Split<'a, T, P>

fn as_slice(self: &Self) -> &'a [T]

Returns a slice which contains items not yet handled by split.

Example

#![feature(split_as_slice)]
let slice = [1,2,3,4,5];
let mut split = slice.split(|v| v % 2 == 0);
assert!(split.next().is_some());
assert_eq!(split.as_slice(), &[3,4,5]);

impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P>

fn next_back(self: &mut Self) -> Option<&'a [T]>

impl<'a, T, P> Freeze for Split<'a, T, P>

impl<'a, T, P> Iterator for Split<'a, T, P>

fn next(self: &mut Self) -> Option<&'a [T]>
fn size_hint(self: &Self) -> (usize, Option<usize>)

impl<'a, T, P> RefUnwindSafe for Split<'a, T, P>

impl<'a, T, P> Send for Split<'a, T, P>

impl<'a, T, P> Sync for Split<'a, T, P>

impl<'a, T, P> Unpin for Split<'a, T, P>

impl<'a, T, P> UnsafeUnpin for Split<'a, T, P>

impl<'a, T, P> UnwindSafe for Split<'a, T, P>

impl<I> IntoIterator for Split<'a, T, P>

fn into_iter(self: Self) -> I

impl<T> Any for Split<'a, T, P>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Split<'a, T, P>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Split<'a, T, P>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Split<'a, T, P>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Split<'a, T, P>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, P> Clone for Split<'_, T, P>

fn clone(self: &Self) -> Self

impl<T, P> FusedIterator for Split<'_, T, P>

impl<T, U> Into for Split<'a, T, P>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Split<'a, T, P>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Split<'a, T, P>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: fmt::Debug, P> Debug for Split<'_, T, P>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result