use crate::{Diff, Trace, Trace2};
pub trait IteratorSimpleScanExt: Iterator {
fn trace<St, F>(self, state: St, f: F) -> Trace<Self, St, F>
where
Self: Sized,
St: Clone,
F: FnMut(&St, Self::Item) -> St,
{
Trace::new(self, state, f)
}
fn trace2<St, F>(self, state: St, f: F) -> Trace2<Self, St, F>
where
Self: Sized,
Self::Item: Clone,
St: Clone,
F: FnMut(&St, Self::Item) -> St,
{
Trace2::new(self, state, f)
}
fn diff<F, D>(self, ini: Self::Item, f: F) -> Diff<Self, F, D>
where
Self: Sized,
Self::Item: Clone,
F: FnMut(Self::Item, Self::Item) -> D,
{
Diff::new(self, ini, f)
}
}
impl<T: Iterator> IteratorSimpleScanExt for T {
}