Trait SplitAtWhile

Source
pub trait SplitAtWhile {
    type Item;

    // Required method
    fn split_at_while<F>(&self, f: F) -> (&Self, &Self)
       where F: FnMut(&Self::Item) -> bool;
}

Required Associated Types§

Required Methods§

Source

fn split_at_while<F>(&self, f: F) -> (&Self, &Self)
where F: FnMut(&Self::Item) -> bool,

Splits a slice at the first point after which f returns false. Usually used to segment input according to character categories.

e.g. 1. part while f(x) == true, then 2. part

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SplitAtWhile for str

Source§

type Item = char

Source§

fn split_at_while<F>(&self, f: F) -> (&Self, &Self)
where F: FnMut(&char) -> bool,

Source§

impl<T> SplitAtWhile for [T]

Source§

type Item = T

Source§

fn split_at_while<F>(&self, f: F) -> (&Self, &Self)
where F: FnMut(&T) -> bool,

Implementors§