pub trait VecExt<T> {
// Required methods
fn sorted(self) -> Self
where T: Ord;
fn sorted_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self;
fn sorted_by_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord;
fn sorted_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord;
fn sorted_unstable(self) -> Self
where T: Ord;
fn sorted_unstable_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self;
fn sorted_unstable_by_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord;
fn reversed(self) -> Self;
}
Expand description
Extension methods for std::vec::Vec
.
Required Methods§
Sourcefn sorted(self) -> Selfwhere
T: Ord,
fn sorted(self) -> Selfwhere
T: Ord,
Same behaviour as Vec::sort
,
but returns itself in a form consistent with chained calls.
Sourcefn sorted_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
fn sorted_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
Same behaviour as Vec::sort_by
,
but returns itself in a form consistent with chained calls.
Sourcefn sorted_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
fn sorted_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
Same behaviour as Vec::sort_by_key
,
but returns itself in a form consistent with chained calls.
Sourcefn sorted_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
fn sorted_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
Same behaviour as Vec::sort_by_cached_key
,
but returns itself in a form consistent with chained calls.
Sourcefn sorted_unstable(self) -> Selfwhere
T: Ord,
fn sorted_unstable(self) -> Selfwhere
T: Ord,
Same behaviour as Vec::sort_unstable
,
but returns itself in a form consistent with chained calls.
Sourcefn sorted_unstable_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
fn sorted_unstable_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self
Same behaviour as Vec::sort_unstable_by
,
but returns itself in a form consistent with chained calls.
Sourcefn sorted_unstable_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
fn sorted_unstable_by_key<K>(self, f: impl FnMut(&T) -> K) -> Selfwhere
K: Ord,
Same behaviour as Vec::sort_unstable_by_key
,
but returns itself in a form consistent with chained calls.
Sourcefn reversed(self) -> Self
fn reversed(self) -> Self
Same behaviour as Vec::reverse
,
but returns itself in a form consistent with chained calls.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.