Trait itermore::IterSorted
source · pub trait IterSorted: Iterator {
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,
{ ... }
}Expand description
An extension trait that provides the sorted method
and friends for iterators.
Provided Methods§
sourcefn sorted(self) -> IntoIter<Self::Item>where
Self: Sized,
Self::Item: Ord,
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.
sourcefn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
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.
sourcefn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>where
Self: Sized,
K: Ord,
F: FnMut(&Self::Item) -> K,
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.
sourcefn sorted_by_cached_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,
Sorts the iterator with a key extraction function.
Simply collects into a Vec and sorts it using
slice::sort_by_cached_key.
sourcefn sorted_unstable(self) -> IntoIter<Self::Item>where
Self: Sized,
Self::Item: Ord,
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.
sourcefn sorted_unstabled_by<F>(self, cmp: F) -> IntoIter<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
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.
sourcefn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>where
Self: Sized,
K: Ord,
F: FnMut(&Self::Item) -> K,
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.