Trait itermore::IterSorted

source ·
pub trait IterSorted: Iterator {
    // Provided methods
    fn sorted(self) -> IntoIter<Self::Item>
       where Self: Sized,
             Self::Item: Ord { ... }
    fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
       where Self: Sized,
             F: FnMut(&Self::Item, &Self::Item) -> Ordering { ... }
    fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
       where Self: Sized,
             K: Ord,
             F: FnMut(&Self::Item) -> K { ... }
    fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
       where Self: Sized,
             K: Ord,
             F: FnMut(&Self::Item) -> K { ... }
    fn sorted_unstable(self) -> IntoIter<Self::Item>
       where Self: Sized,
             Self::Item: Ord { ... }
    fn sorted_unstabled_by<F>(self, cmp: F) -> IntoIter<Self::Item>
       where Self: Sized,
             F: FnMut(&Self::Item, &Self::Item) -> Ordering { ... }
    fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
       where Self: Sized,
             K: Ord,
             F: FnMut(&Self::Item) -> K { ... }
}
Available on crate feature sorted only.
Expand description

An extension trait that provides the sorted method and friends for iterators.

Provided Methods§

source

fn sorted(self) -> IntoIter<Self::Item>
where Self: Sized, Self::Item: Ord,

Sorts the iterator.

Simply collects into a Vec and sorts it using slice::sort.

source

fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sorts the iterator with a comparator function.

Simply collects into a Vec and sorts it using slice::sort_by.

source

fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where Self: Sized, K: Ord, F: FnMut(&Self::Item) -> K,

Sorts the iterator with a key extraction function.

Simply collects into a Vec and sorts it using slice::sort_by_key.

source

fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where Self: Sized, K: Ord, F: FnMut(&Self::Item) -> K,

Sorts the iterator with a key extraction function.

Simply collects into a Vec and sorts it using slice::sort_by_cached_key.

source

fn sorted_unstable(self) -> IntoIter<Self::Item>
where Self: Sized, Self::Item: Ord,

Sorts the iterator, but might not preserve the order of equal elements.

Simply collects into a Vec and sorts it using slice::sort_unstable.

source

fn sorted_unstabled_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sorts the iterator with a comparator function, but might not preserve the order of equal elements.

Simply collects into a Vec and sorts it using slice::sort_unstable_by.

source

fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where Self: Sized, K: Ord, F: FnMut(&Self::Item) -> K,

Sorts the iterator with a key extraction function, but might not preserve the order of equal elements.

Simply collects into a Vec and sorts it using slice::sort_unstable_by_key.

Implementors§

source§

impl<I> IterSorted for I
where I: Iterator + ?Sized,