[−][src]Function out::max_unstable
pub fn max_unstable<T: Ord>(v: &mut [T], n: usize) -> &mut [T]
Get the n
largest items.
This method is not stable, i.e. it may not preserve the order of equal elements.
This method should be faster than max
in most cases, and can be used with no_std
.
Panics
Panics if n > len
.
Examples
let mut v = [-5, 4, 1, -3, 2]; let max = out::max_unstable(&mut v, 3); assert_eq!(max, [1, 2, 4]);