Function afsort::sort_unstable_by [] [src]

pub fn sort_unstable_by<T, O, S>(vec: &mut [T], sort_by: S) where
    O: Ord + DigitAt,
    S: Fn(&T) -> &O, 

Sort method which accepts function to convert elements to &[u8].

#Example

let mut tuples = vec![("b", 2), ("a", 1)];
afsort::sort_unstable_by(&mut tuples, |t| &t.0);
assert_eq!(tuples, vec![("a", 1), ("b", 2)]);

Footnote: The explicit type annotacion in the closure seems to be needed (even though it should not). See this discussion.