Function buldak::double_selection::sort_by
source · pub fn sort_by<T, F>(array: &mut [T], compare: F)
Expand description
It takes a comparator function to determine the order, and sorts it using a double selection sort algorithm.
use buldak::double_selection;
let mut nums = [1, 4, 2, 3, 5, 111, 234, 21, 13];
double_selection::sort_by(&mut nums, |l, r| l.cmp(r));
assert_eq!(nums, [1, 2, 3, 4, 5, 13, 21, 111, 234]);