Function quickersort::sort_by [] [src]

pub fn sort_by<T, C: Fn(&T, &T) -> Ordering>(v: &mut [T], compare: &C)

Sort using a comparison function.

Example

let mut unsorted = [1, 3, 9, 2, 6, 5];
let sorted = [9, 6, 5, 3, 2, 1];
::quickersort::sort_by(&mut unsorted, &|a, b| b.cmp(a));
assert_eq!(unsorted, sorted);