Trait slice_group_by::StrGroupBy

source ·
pub trait StrGroupBy {
    // Required methods
    fn linear_group_by_key<F, K>(&self, func: F) -> LinearStrGroupByKey<'_, F> 
       where F: FnMut(char) -> K,
             K: PartialEq;
    fn linear_group_by<P>(&self, predicate: P) -> LinearStrGroupBy<'_, P> 
       where P: FnMut(char, char) -> bool;
    fn linear_group(&self) -> LinearStrGroup<'_> ;
}
Expand description

A convenient trait to construct an iterator returning non-overlapping str slices defined by a predicate.

Required Methods§

source

fn linear_group_by_key<F, K>(&self, func: F) -> LinearStrGroupByKey<'_, F>
where F: FnMut(char) -> K, K: PartialEq,

Returns an iterator on str groups based that will use the given function to generate keys and determine groups based on them. It uses linear search to iterate over groups.

source

fn linear_group_by<P>(&self, predicate: P) -> LinearStrGroupBy<'_, P>
where P: FnMut(char, char) -> bool,

Returns an iterator on str groups using the linear search method.

source

fn linear_group(&self) -> LinearStrGroup<'_>

Returns an iterator on str groups based on the PartialEq::eq method of char, it uses linear search to iterate over groups.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl StrGroupBy for str

source§

fn linear_group_by_key<F, K>(&self, func: F) -> LinearStrGroupByKey<'_, F>
where F: FnMut(char) -> K, K: PartialEq,

source§

fn linear_group_by<P>(&self, predicate: P) -> LinearStrGroupBy<'_, P>
where P: FnMut(char, char) -> bool,

source§

fn linear_group(&self) -> LinearStrGroup<'_>

Implementors§