1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use std::marker::PhantomData; use super::IsSorted; pub struct SortedIter<I, O> { pub(crate) inner: I, pub(crate) ordering: PhantomData<O>, } impl<I, O> Iterator for SortedIter<I, O> where I: Iterator { type Item = I::Item; fn next(&mut self) -> Option<Self::Item> { self.inner.next() } } impl<I, O> IsSorted for SortedIter<I, O> { type Ordering = O; }