Skip to main content

TrySort

Trait TrySort 

Source
pub trait TrySort<T> {
    // Required methods
    fn try_sort_by<F>(&mut self, compare: F) -> OrderResult<()>
       where F: FnMut(&T, &T) -> Option<bool>;
    fn try_sort_by_cached_key<K, F>(&mut self, f: F) -> OrderResult<()>
       where F: FnMut(&T) -> Option<K>,
             K: PartialOrd<K>;
    fn try_sort_unstable_by<F>(&mut self, compare: F) -> OrderResult<()>
       where F: FnMut(&T, &T) -> Option<bool>;
    fn try_is_sorted_by<F>(&self, compare: F) -> OrderResult<bool>
       where F: FnMut(&T, &T) -> Option<bool>;

    // Provided methods
    fn try_sort(&mut self) -> OrderResult<()>
       where T: PartialOrd<T> { ... }
    fn try_sort_by_key<K, F>(&mut self, f: F) -> OrderResult<()>
       where F: FnMut(&T) -> Option<K>,
             K: PartialOrd<K> { ... }
    fn try_sort_unstable(&mut self) -> OrderResult<()>
       where T: PartialOrd<T> { ... }
    fn try_sort_unstable_by_key<K, F>(&mut self, f: F) -> OrderResult<()>
       where F: FnMut(&T) -> Option<K>,
             K: PartialOrd<K> { ... }
    fn try_is_sorted(&self) -> OrderResult<bool>
       where T: PartialOrd<T> { ... }
    fn try_is_sorted_by_key<K, F>(&mut self, f: F) -> OrderResult<bool>
       where F: FnMut(&T) -> Option<K>,
             K: PartialOrd<K> { ... }
}
Expand description

Sort methods for PartialOrd.

Required Methods§

Source

fn try_sort_by<F>(&mut self, compare: F) -> OrderResult<()>
where F: FnMut(&T, &T) -> Option<bool>,

Source

fn try_sort_by_cached_key<K, F>(&mut self, f: F) -> OrderResult<()>
where F: FnMut(&T) -> Option<K>, K: PartialOrd<K>,

Source

fn try_sort_unstable_by<F>(&mut self, compare: F) -> OrderResult<()>
where F: FnMut(&T, &T) -> Option<bool>,

Source

fn try_is_sorted_by<F>(&self, compare: F) -> OrderResult<bool>
where F: FnMut(&T, &T) -> Option<bool>,

Provided Methods§

Source

fn try_sort(&mut self) -> OrderResult<()>
where T: PartialOrd<T>,

PartialOrd version for slice::sort

Source

fn try_sort_by_key<K, F>(&mut self, f: F) -> OrderResult<()>
where F: FnMut(&T) -> Option<K>, K: PartialOrd<K>,

Source

fn try_sort_unstable(&mut self) -> OrderResult<()>
where T: PartialOrd<T>,

Source

fn try_sort_unstable_by_key<K, F>(&mut self, f: F) -> OrderResult<()>
where F: FnMut(&T) -> Option<K>, K: PartialOrd<K>,

Source

fn try_is_sorted(&self) -> OrderResult<bool>
where T: PartialOrd<T>,

Source

fn try_is_sorted_by_key<K, F>(&mut self, f: F) -> OrderResult<bool>
where F: FnMut(&T) -> Option<K>, K: PartialOrd<K>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> TrySort<T> for [T]

Source§

fn try_sort_by<F>(&mut self, compare: F) -> OrderResult<()>
where F: FnMut(&T, &T) -> Option<bool>,

Source§

fn try_sort_unstable_by<F>(&mut self, compare: F) -> OrderResult<()>
where F: FnMut(&T, &T) -> Option<bool>,

Source§

fn try_is_sorted_by<F>(&self, compare: F) -> OrderResult<bool>
where F: FnMut(&T, &T) -> Option<bool>,

Source§

fn try_sort_by_cached_key<K, F>(&mut self, f: F) -> OrderResult<()>
where F: FnMut(&T) -> Option<K>, K: PartialOrd<K>,

Implementors§