Struct Fuse

struct Fuse<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.

Implementations

impl<I> DoubleEndedIterator for Fuse<I>

fn next_back(self: &mut Self) -> Option<<I as Iterator>::Item>
fn nth_back(self: &mut Self, n: usize) -> Option<<I as Iterator>::Item>
fn try_rfold<Acc, Fold, R>(self: &mut Self, acc: Acc, fold: Fold) -> R
where
    Self: Sized,
    Fold: FnMut(Acc, <Self as >::Item) -> R,
    R: Try<Output = Acc>
fn rfold<Acc, Fold>(self: Self, acc: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, <Self as >::Item) -> Acc
fn rfind<P>(self: &mut Self, predicate: P) -> Option<<Self as >::Item>
where
    P: FnMut(&<Self as >::Item) -> bool

impl<I> ExactSizeIterator for Fuse<I>

fn len(self: &Self) -> usize
fn is_empty(self: &Self) -> bool

impl<I> Freeze for Fuse<I>

impl<I> FusedIterator for Fuse<I>

impl<I> IntoIterator for Fuse<I>

fn into_iter(self: Self) -> I

impl<I> Iterator for Fuse<I>

fn next(self: &mut Self) -> Option<<Self as >::Item>
fn nth(self: &mut Self, n: usize) -> Option<<I as >::Item>
fn last(self: Self) -> Option<<Self as >::Item>
fn count(self: Self) -> usize
fn size_hint(self: &Self) -> (usize, Option<usize>)
fn try_fold<Acc, Fold, R>(self: &mut Self, acc: Acc, fold: Fold) -> R
where
    Self: Sized,
    Fold: FnMut(Acc, <Self as >::Item) -> R,
    R: Try<Output = Acc>
fn fold<Acc, Fold>(self: Self, acc: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, <Self as >::Item) -> Acc
fn find<P>(self: &mut Self, predicate: P) -> Option<<Self as >::Item>
where
    P: FnMut(&<Self as >::Item) -> bool

impl<I> RefUnwindSafe for Fuse<I>

impl<I> Send for Fuse<I>

impl<I> Sync for Fuse<I>

impl<I> TrustedLen for Fuse<I>

impl<I> Unpin for Fuse<I>

impl<I> UnsafeUnpin for Fuse<I>

impl<I> UnwindSafe for Fuse<I>

impl<I: $crate::clone::Clone> Clone for Fuse<I>

fn clone(self: &Self) -> Fuse<I>

impl<I: $crate::fmt::Debug> Debug for Fuse<I>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<I: Default> Default for Fuse<I>

fn default() -> Self

Creates a Fuse iterator from the default value of I.

# use core::slice;
# use std::iter::Fuse;
let iter: Fuse<slice::Iter<'_, u8>> = Default::default();
assert_eq!(iter.len(), 0);

This is equivalent to I::default().fuse()1; e.g. if I::default() is not an empty iterator, then this will not be an empty iterator.

# use std::iter::Fuse;
#[derive(Default)]
struct Fourever;

impl Iterator for Fourever {
    type Item = u32;
    fn next(&mut self) -> Option<u32> {
        Some(4)
    }
}

let mut iter: Fuse<Fourever> = Default::default();
assert_eq!(iter.next(), Some(4));
  1. if I does not override Iterator::fuse's default implementation

impl<T> Any for Fuse<I>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Fuse<I>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Fuse<I>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Fuse<I>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Fuse<I>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Fuse<I>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Fuse<I>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Fuse<I>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>