You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Those two adaptors are quite similar, except one handles an additional index.
While specializing nth/last/count for them, I nearly wrote the same code.
Before going further, I think they should be aliases of a more general struct.
Merge those would reduce duplication and additionally provide more methods for MultiPeek for "free".
I note that most of methods' documentation would be merged. We would need to be "careful" on this.
Draft
#[derive(Debug,Clone)]/*kept private*/structMultiPeekGeneral<I:Iterator,Idx>{iter:Fuse<I>,buf:VecDeque<I::Item>,index:Idx,}pubtypeMultiPeek<I> = MultiPeekGeneral<I,usize>;pubtypePeekNth<I> = MultiPeekGeneral<I,()>;/*kept private*/traitPeekIndex{ ... }// fn reset_index probably. Maybe more.implPeekIndexfor(){ ... }implPeekIndexforusize{ ... }impl<I:Iterator,Idx:PeekIndex>MultiPeekGeneral<I,Idx>{// public functions: peek peek_mut peek_nth peek_nth_mut next_if next_if_eq nth_if nth_if_eq}impl<I:Iterator>MultiPeek<I>{// not for PeekNth// public functions: reset_peek}impl<I:Iterator,Idx>IteratorforMultiPeekGeneral<I,Idx>{ ... }impl<I:ExactSizeIterator,Idx>ExactSizeIteratorforMultiPeekGeneral<I,Idx>{}impl<I:Iterator,Idx>PeekingNextforMultiPeekGeneral<I,Idx>{ ... }
The text was updated successfully, but these errors were encountered:
Those two adaptors are quite similar, except one handles an additional index.
While specializing
nth/last/count
for them, I nearly wrote the same code.Before going further, I think they should be aliases of a more general struct.
Merge those would reduce duplication and additionally provide more methods for
MultiPeek
for "free".I note that most of methods' documentation would be merged. We would need to be "careful" on this.
Draft
The text was updated successfully, but these errors were encountered: