Trait algorithms_rs::sort::Sort

source ·
pub trait Sort<T: PartialOrd + Clone> {
    fn inner(&self) -> Vec<T>;
    fn sort_by<F>(&mut self, f: F)
    where
        F: FnOnce(&T, &T) -> bool + Copy
; fn sort(&mut self) { ... } fn is_sort(&self) -> bool { ... } fn is_sort_by<F>(&self, f: F) -> bool
    where
        F: FnOnce(&T, &T) -> bool + Copy
, { ... } }
Expand description

Generic interface to sorting algorithms

Required Methods§

Get the internal data

Customizable comparison logic based on closures

Provided Methods§

Sort by ascending order

Determine if the sort is ascending

Customized judgments are ordered

Examples found in repository?
src/sort/mod.rs (line 27)
26
27
28
    fn is_sort(&self) -> bool {
        self.is_sort_by(|v1, v2| v1 <= v2)
    }

Implementors§