Function partial_sort

pub fn partial_sort<T, F, R>(v: &mut [T], range: R, is_less: F)
where
    F: FnMut(&T, &T) -> bool,
    R: RangeBounds<usize>,

Unstable partial sort the range start..end, after which it's guaranteed that:

  1. Every element in v[..start] is smaller than or equal to
  2. Every element in v[start..end], which is sorted, and smaller than or equal to
  3. Every element in v[end..].