Trait SliceCompareExt

Source
pub trait SliceCompareExt<T> {
    // Required methods
    fn self_comparer(&self) -> Comparer<'_, T> ;
    fn self_comparer_mut(&mut self) -> ComparerMut<'_, T>;

    // Provided methods
    fn compare_self<F: FnMut(&T, &T)>(&self, f: F) { ... }
    fn compare_self_enumerated<F: FnMut((usize, &T), (usize, &T))>(&self, f: F) { ... }
    fn compare_self_mut<F: FnMut(&mut T, &mut T)>(&mut self, f: F) { ... }
    fn compare_self_enumerated_mut<F: FnMut((usize, &mut T), (usize, &mut T))>(
        &mut self,
        f: F,
    ) { ... }
}
Expand description

Extra methods for slices to compare with self

Required Methods§

Source

fn self_comparer(&self) -> Comparer<'_, T>

Returns a Comparer from a reference to a slice

Source

fn self_comparer_mut(&mut self) -> ComparerMut<'_, T>

Returns a Comparer from a reference to a mutable slice

Provided Methods§

Source

fn compare_self<F: FnMut(&T, &T)>(&self, f: F)

Convenience function for itereating through the Comparer and applying a function to each pair

Source

fn compare_self_enumerated<F: FnMut((usize, &T), (usize, &T))>(&self, f: F)

Same as compare_self() but also parses the indices of the elements to the function

Source

fn compare_self_mut<F: FnMut(&mut T, &mut T)>(&mut self, f: F)

Convenience function for itereating through the ComparerMut and applying a function to each pair

Source

fn compare_self_enumerated_mut<F: FnMut((usize, &mut T), (usize, &mut T))>( &mut self, f: F, )

Same as compare_self_mut() but also parses the indices of the elements to the function

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<T> SliceCompareExt<T> for [T]

Source§

fn self_comparer(&self) -> Comparer<'_, T>

Source§

fn self_comparer_mut(&mut self) -> ComparerMut<'_, T>

Implementors§