#[doc(hidden)] trait FuseImpl<I> {
type Item;
// Required methods
fn next(&mut self) -> Option<Self::Item>;
fn nth(&mut self, n: usize) -> Option<Self::Item>;
fn try_fold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> R
where Self: Sized,
Fold: FnMut(Acc, Self::Item) -> R,
R: Try<Output = Acc>;
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where P: FnMut(&Self::Item) -> bool;
fn next_back(&mut self) -> Option<Self::Item>
where I: DoubleEndedIterator;
fn nth_back(&mut self, n: usize) -> Option<Self::Item>
where I: DoubleEndedIterator;
fn try_rfold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> R
where Self: Sized,
Fold: FnMut(Acc, Self::Item) -> R,
R: Try<Output = Acc>,
I: DoubleEndedIterator;
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where P: FnMut(&Self::Item) -> bool,
I: DoubleEndedIterator;
}
Expand description
Fuse specialization trait
We only need to worry about &mut self
methods, which
may exhaust the iterator without consuming it.
Required Associated Types§
Required Methods§
fn next(&mut self) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn try_fold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> R
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn next_back(&mut self) -> Option<Self::Item>where
I: DoubleEndedIterator,
fn nth_back(&mut self, n: usize) -> Option<Self::Item>where
I: DoubleEndedIterator,
fn try_rfold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> R
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl<I> FuseImpl<I> for Fuse<I>where
I: Iterator,
General Fuse
impl which sets iter = None
when exhausted.
impl<I> FuseImpl<I> for Fuse<I>where
I: Iterator,
General Fuse
impl which sets iter = None
when exhausted.
impl<I> FuseImpl<I> for Fuse<I>where
I: FusedIterator,
Specialized Fuse
impl which doesn’t bother clearing iter
when exhausted.
However, we must still be prepared for the possibility that it was already cleared!