pub trait SliceExt<T> {
// Required methods
fn trim_start_matches<F>(&self, f: F) -> &[T]
where F: FnMut(&T) -> bool;
fn trim_end_matches<F>(&self, f: F) -> &[T]
where F: FnMut(&T) -> bool;
fn group_by_key<K, F>(&self, f: F) -> GroupByKey<'_, T, F> ⓘ
where F: FnMut(&T) -> K,
K: PartialEq;
}
Expand description
Extra methods for [T]
.
Required Methods§
sourcefn trim_start_matches<F>(&self, f: F) -> &[T]
fn trim_start_matches<F>(&self, f: F) -> &[T]
Returns a slice with all matching elements from the start of the slice removed.
sourcefn trim_end_matches<F>(&self, f: F) -> &[T]
fn trim_end_matches<F>(&self, f: F) -> &[T]
Returns a slice with all matching elements from the end of the slice removed.
sourcefn group_by_key<K, F>(&self, f: F) -> GroupByKey<'_, T, F> ⓘ
fn group_by_key<K, F>(&self, f: F) -> GroupByKey<'_, T, F> ⓘ
Split a slice into consecutive runs with the same key and yield for each such run the key and the slice of elements with that key.
Object Safety§
This trait is not object safe.