Trait VecExt

Source
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§

Source

fn sorted(self) -> Self
where T: Ord,

Same behaviour as Vec::sort, but returns itself in a form consistent with chained calls.

Source

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.

Source

fn sorted_by_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord,

Same behaviour as Vec::sort_by_key, but returns itself in a form consistent with chained calls.

Source

fn sorted_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord,

Same behaviour as Vec::sort_by_cached_key, but returns itself in a form consistent with chained calls.

Source

fn sorted_unstable(self) -> Self
where T: Ord,

Same behaviour as Vec::sort_unstable, but returns itself in a form consistent with chained calls.

Source

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.

Source

fn sorted_unstable_by_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord,

Same behaviour as Vec::sort_unstable_by_key, but returns itself in a form consistent with chained calls.

Source

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.

Implementations on Foreign Types§

Source§

impl<T> VecExt<T> for Vec<T>

Source§

fn sorted(self) -> Self
where T: Ord,

Source§

fn sorted_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self

Source§

fn sorted_by_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord,

Source§

fn sorted_by_cached_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord,

Source§

fn sorted_unstable(self) -> Self
where T: Ord,

Source§

fn sorted_unstable_by(self, compare: impl FnMut(&T, &T) -> Ordering) -> Self

Source§

fn sorted_unstable_by_key<K>(self, f: impl FnMut(&T) -> K) -> Self
where K: Ord,

Source§

fn reversed(self) -> Self

Implementors§