Function max_by
const fn max_by<T, F: ~const FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T
Returns the maximum of two values with respect to the specified comparison function.
Returns the second argument if the comparison determines them to be equal.
The parameter order is preserved when calling the compare function, i.e. v1 is
always passed as the first argument and v2 as the second.
Examples
use cmp;
let abs_cmp = ;
let result = max_by ;
assert_eq!;
let result = max_by;
assert_eq!;
let result = max_by;
assert_eq!;