Tracking Issue for cmp::minmax{_by,_by_key}
· Issue #115939 · rust-lang/rust (original) (raw)
Feature gate: #![feature(cmp_minmax)]
This is a tracking issue for core::cmp::minmax{_by,_by_key}
.
Those functions take two values and return an array of [min, max]
. This is essentially a sort specialized for two arguments.
Public API
// core::cmp
pub fn minmax(v1: T, v2: T) -> [T; 2] where T: Ord;
pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2] where F: FnOnce(&T, &T) -> Ordering;
pub fn minmax_by_key<T, F, K>(v1: T, v2: T, f: F) -> [T; 2] where F: FnMut(&T) -> K, K: Ord;
Steps / History
- Implementation: Add minmax{,_by,_by_key} functions to core::cmp #109409
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.