GraphsSliceExt

Trait GraphsSliceExt 

Source
pub trait GraphsSliceExt<T> {
    // Required methods
    fn is_sorted_by_prop<P, K>(&self, prop: P) -> bool
       where P: PropGet<K>,
             for<'a> &'a T: IntoOwned<K>,
             P::Output: Ord;
    fn sort_by_prop<P, K>(&mut self, prop: P)
       where P: PropGet<K>,
             for<'a> &'a T: IntoOwned<K>,
             P::Output: Ord;
    fn sort_unstable_by_prop<P, K>(&mut self, prop: P)
       where P: PropGet<K>,
             for<'a> &'a T: IntoOwned<K>,
             P::Output: Ord;
    fn binary_search_by_prop<P, K>(
        &self,
        prop_value: &P::Output,
        prop: P,
    ) -> Result<usize, usize>
       where P: PropGet<K>,
             for<'a> &'a T: IntoOwned<K>,
             P::Output: Ord;
}
Expand description

Extension trait for slices.

See the module documentation for examples.

Required Methods§

Source

fn is_sorted_by_prop<P, K>(&self, prop: P) -> bool
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Returns true if a slice is sorted according to a property, otherwise, returns false.

Source

fn sort_by_prop<P, K>(&mut self, prop: P)
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Sort a slice using a property.

This functions calls slice::sort_by_key.

Source

fn sort_unstable_by_prop<P, K>(&mut self, prop: P)
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Sort a slice using a property.

This functions calls slice::sort_unstable_by_key.

Source

fn binary_search_by_prop<P, K>( &self, prop_value: &P::Output, prop: P, ) -> Result<usize, usize>
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Binary searches a slice that is sorted by a property.

This functions calls slice::binary_search_by_key.

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

Source§

fn is_sorted_by_prop<P, K>(&self, prop: P) -> bool
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Source§

fn sort_by_prop<P, K>(&mut self, prop: P)
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Source§

fn sort_unstable_by_prop<P, K>(&mut self, prop: P)
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Source§

fn binary_search_by_prop<P, K>( &self, prop_value: &P::Output, prop: P, ) -> Result<usize, usize>
where P: PropGet<K>, for<'a> &'a T: IntoOwned<K>, P::Output: Ord,

Implementors§