IfDeterminismIteratorExt

Trait IfDeterminismIteratorExt 

Source
pub trait IfDeterminismIteratorExt: Iterator + Sealed {
    // Provided methods
    fn if_determinism_then_sort(self) -> IntoIter<Self::Item>
       where Self: Sized,
             Self::Item: Ord { ... }
    fn if_determinism_then_sort_by<F>(self, cmp: F) -> IntoIter<Self::Item>
       where Self: Sized,
             F: FnMut(&Self::Item, &Self::Item) -> Ordering { ... }
}
Expand description

Extensions of iterator to sort items of the iterator. Replaced by a no-op when determinism is switched off. Useful, for example, to eliminate non-deterministic iteration of HashMap and HashSet keys.

Provided Methods§

Source

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

Sorts the slice. Replaced by a no-op when determinism is switched off. Useful, for example, to eliminate non-deterministic iteration of HashMap and HashSet keys.

Source

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

Sorts the slice with a comparator function. Replaced by a no-op when determinism is switched off. Useful, for example, to eliminate non-deterministic iteration of HashMap and HashSet keys.

Implementors§