Feature gate: #![feature(slice_partial_sort_unstable)]
This is a tracking issue for rust-lang/libs-team#685.
Public API
impl<T> [T] {
pub fn partial_sort_unstable<R>(&mut self, range: R) where T: Ord, R: RangeBounds<usize> { ... }
pub fn partial_sort_unstable_by<F, R>(&mut self, range: R, mut compare: F) where F: FnMut(&T, &T) -> Ordering, R: RangeBounds<usize> { ... }
pub fn partial_sort_unstable_by_key<K, F, R>(&mut self, range: R, mut f: F) where F: FnMut(&T) -> K, K: Ord, R: RangeBounds<usize> { ... }
}
#[test]
fn demostration() {
let mut before: Vec<u32> = vec![4, 4, 3, 3, 1, 1, 2, 2];
let last = 6;
let mut d = before.clone();
d.sort();
before.partial_sort_unstable_by(..last, |a, b| a.cmp(b));
assert_eq!(&d[0..last], &before[0..last]);
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
Unresolved Questions
Feature gate:
#![feature(slice_partial_sort_unstable)]This is a tracking issue for rust-lang/libs-team#685.
Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)partial_sortmethod to[T]libs-team#685Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩