pub trait IteratorExt: Iterator {
// Provided methods
fn is_strict_total_order(self) -> bool
where Self: Sized,
Self::Item: PartialOrd { ... }
fn is_strict_total_order_by_key<F, K>(self, f: F) -> bool
where Self: Sized,
F: FnMut(Self::Item) -> K,
K: PartialOrd { ... }
fn min_max(self) -> Option<(Self::Item, Self::Item)>
where Self: Sized,
Self::Item: Copy + Ord { ... }
}Expand description
Iterator extension trait
Provided Methods§
Sourcefn is_strict_total_order(self) -> bool
fn is_strict_total_order(self) -> bool
Returns true iff the iterator is a strict total order. This implies
the iterator is sorted and all elements are unique.
ⓘ
[x_1, ..., x_n].is_strict_total_order()
:= x_1 < x_2 < ... < x_n§Examples
use std::iter;
use lexe_std::iter::IteratorExt;
assert!(iter::empty::<u32>().is_strict_total_order());
assert!(&[1].iter().is_strict_total_order());
assert!(&[1, 2, 6].iter().is_strict_total_order());
assert!(!&[2, 1].iter().is_strict_total_order());
assert!(!&[1, 2, 2, 3].iter().is_strict_total_order());Sourcefn is_strict_total_order_by_key<F, K>(self, f: F) -> bool
fn is_strict_total_order_by_key<F, K>(self, f: F) -> bool
Returns true iff the iterator is a strict total order according to the
key extraction function f.
ⓘ
[x_1, ..., x_n].is_strict_total_order_by_key(f)
:= f(x_1) < f(x_2) < ... < f(x_n)