Struct Fuse
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Fuse<I> { pub(in ::iter::adapters::fuse) iter: Option<I> }
An iterator that yields None forever after the underlying iterator
yields None once.
This struct is created by Iterator::fuse. See its documentation
for more.
Fields
iter: Option<I>
Implementations
impl<I> Fuse<I>
const fn new(iter: I) -> Fuse<I>fn into_inner(self) -> Option<I>
Trait Implementations
impl<I> DoubleEndedIterator for Fuse<I>
where
I: DoubleEndedIterator,
fn next_back(&mut self) -> Option<<I as Iterator>::Item>fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>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>,fn rfold<Acc, Fold>(self, acc: Acc, fold: Fold) -> Acc where Fold: FnMut(Acc, Self::Item) -> Acc,fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool,
impl<I> ExactSizeIterator for Fuse<I>
where
I: ExactSizeIterator,
fn len(&self) -> usizefn is_empty(&self) -> bool
impl<I> FuseImpl<I> for Fuse<I>
where
I: FusedIterator,
fn next(&mut self) -> Option<<I as Iterator>::Item>fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>fn nth(&mut self, n: usize) -> Option<I::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<<I as Iterator>::Item> where I: DoubleEndedIterator,fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::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,
impl<I> FuseImpl<I> for Fuse<I>
where
I: Iterator,
type Item = <I as Iterator>::Item;fn next(&mut self) -> Option<<I as Iterator>::Item>fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>fn nth(&mut self, n: usize) -> Option<I::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<<I as Iterator>::Item> where I: DoubleEndedIterator,fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::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,
impl<I> FusedIterator for Fuse<I>
where
I: Iterator,
impl<I> Iterator for Fuse<I>
where
I: Iterator,
type Item = <I as Iterator>::Item;fn next(&mut self) -> Option<Self::Item>fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>fn nth(&mut self, n: usize) -> Option<I::Item>fn last(self) -> Option<Self::Item>fn count(self) -> usizefn size_hint(&self) -> (usize, Option<usize>)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 fold<Acc, Fold>(self, acc: Acc, fold: Fold) -> Acc where Fold: FnMut(Acc, Self::Item) -> Acc,fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool,unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccessNoCoerce,
impl<I> SourceIter for Fuse<I>
where
I: SourceIter + TrustedFused,
type Source = <I as SourceIter>::Source;unsafe fn as_inner(&mut self) -> &mut I::Source
impl<I> TrustedFused for Fuse<I>
where
I: TrustedFused,
impl<I> TrustedLen for Fuse<I>
where
I: TrustedLen,
impl<I> TrustedRandomAccess for Fuse<I>
where
I: TrustedRandomAccess,
impl<I> TrustedRandomAccessNoCoerce for Fuse<I>
where
I: TrustedRandomAccessNoCoerce,
const MAY_HAVE_SIDE_EFFECT: bool = I::MAY_HAVE_SIDE_EFFECT;
impl<I: Clone> Clone for Fuse<I>
fn clone(&self) -> Fuse<I>
impl<I: Debug> Debug for Fuse<I>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<I: Default> Default for Fuse<I>
fn default() -> SelfCreates a
Fuseiterator from the default value ofI.# use slice; # use Fuse; let iter: = Defaultdefault; assert_eq!;This is equivalent to
I::default().fuse()1; e.g. ifI::default()is not an empty iterator, then this will not be an empty iterator.# use Fuse; ; let mut iter: = Defaultdefault; assert_eq!;-
if
Idoes not overrideIterator::fuse's default implementation ↩
-
Auto Trait Implementations
impl<I> Freeze for Fuse<I>
where
Option<I>: Freeze,
impl<I> RefUnwindSafe for Fuse<I>
where
Option<I>: RefUnwindSafe,
impl<I> Send for Fuse<I>
where
Option<I>: Send,
impl<I> Sync for Fuse<I>
where
Option<I>: Sync,
impl<I> Unpin for Fuse<I>
where
Option<I>: Unpin,
impl<I> UnsafeUnpin for Fuse<I>
where
Option<I>: UnsafeUnpin,
impl<I> UnwindSafe for Fuse<I>
where
Option<I>: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for Fuse<I>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Fuse<I>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Fuse<I>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Fuse<I>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Fuse<I>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Fuse<I>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Fuse<I>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Fuse<I>
impl<T, U> Into<U> for Fuse<I>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Fuse<I>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Fuse<I>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>