Fuse

Struct Fuse 

Source
pub struct Fuse<I: NonEmptyIterator> { /* private fields */ }
Expand description

Represents non-empty iterators that yield None forever after the underlying iterator yields None once.

This struct is created by the fuse method on NonEmptyIterator. See its documentation for more.

Implementations§

Source§

impl<I: NonEmptyIterator> Fuse<I>

Source

pub const fn new(non_empty: I) -> Self

Constructs Self.

Trait Implementations§

Source§

impl<I: Clone + NonEmptyIterator> Clone for Fuse<I>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I: Debug + NonEmptyIterator> Debug for Fuse<I>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<I: NonEmptyIterator> IntoIterator for Fuse<I>

Source§

type Item = <I as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = Fuse<<I as IntoIterator>::IntoIter>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<I: NonEmptyIterator> NonEmptyIterator for Fuse<I>

Source§

fn consume(self) -> (Self::Item, Self::IntoIter)

Consumes the non-empty iterator, returning the next item along with the possibly empty iterator.
Source§

fn count(self) -> Size

Consumes the non-empty iterator, returning the item count. Read more
Source§

fn enumerate(self) -> Enumerate<Self>

Creates non-empty iterators that yield the current count and the item during iteration. Read more
Source§

fn peeked(self) -> Peeked<Self::IntoIter>

Peeks at the next item of the non-empty iterator, returning it along with the possibly empty iterator. Read more
Source§

fn chain<I: IntoIterator<Item = Self::Item>>( self, other: I, ) -> Chain<Self, I::IntoIter>

Links the non-empty iterator with the provided possibly empty iterator. Read more
Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where Self: NonEmptyIterator<Item = &'a T>, T: Clone + 'a,

Creates non-empty iterators that clone the items of the underlying non-empty iterator. Read more
Source§

fn copied<'a, T>(self) -> Copied<Self>
where Self: NonEmptyIterator<Item = &'a T>, T: Copy + 'a,

Creates non-empty iterators that copy the items of the underlying non-empty iterator. Read more
Source§

fn zip<I: IntoNonEmptyIterator>( self, other: I, ) -> Zip<Self, I::IntoNonEmptyIter>

Zips the non-empty iterator with the provided non-empty iterator. Read more
Source§

fn sum<S: Sum<Self::Item>>(self) -> S

Sums the items of the non-empty iterator together. Read more
Source§

fn product<P: Product<Self::Item>>(self) -> P

Multiplies the items of the non-empty iterator together. Read more
Source§

fn all<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool

Tests whether all items of the non-empty iterator match the predicate. Read more
Source§

fn any<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool

Tests whether any items of the non-empty iterator match the predicate. Read more
Source§

fn none<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool

Tests whether no items of the non-empty iterator match the predicate. Read more
Source§

fn reduce<F>(self, function: F) -> Self::Item
where F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the items of the non-empty iterator into the single one by repeatedly applying the given function. Read more
Source§

fn unzip<T, U, C: Default + Extend<T>, D: Default + Extend<U>>(self) -> (C, D)
where Self: NonEmptyIterator<Item = (T, U)>,

Converts the non-empty iterator of pairs into the pair of collections. Read more
Source§

fn collect<C: FromIterator<Self::Item>>(self) -> C

Equivalent to collect on Iterator. Read more
Source§

fn collect_non_empty<C: FromNonEmptyIterator<Self::Item>>(self) -> C

Collects the items of the non-empty iterator into the collection. Read more
Source§

fn flat_map<J: IntoNonEmptyIterator, F: FnMut(Self::Item) -> J>( self, function: F, ) -> FlatMap<Self, J, F>

Similar to map, but flattens produced non-empty iterators. Read more
Source§

fn flatten(self) -> Flatten<Self>

Flattens one level of nesting in self non-empty iterator. Read more
Source§

fn filter<P: FnMut(&Self::Item) -> bool>( self, predicate: P, ) -> Filter<Self::IntoIter, P>

Equivalent to filter on Iterator. Read more
Source§

fn find<P: FnMut(&Self::Item) -> bool>(self, predicate: P) -> Option<Self::Item>

Equivalent to find on Iterator.
Source§

fn filter_map<T, F: FnMut(Self::Item) -> Option<T>>( self, function: F, ) -> FilterMap<Self::IntoIter, F>

Equivalent to filter_map on Iterator. Read more
Source§

fn fold<A, F: FnMut(A, Self::Item) -> A>(self, initial: A, function: F) -> A

Equivalent to fold on Iterator.
Source§

fn map<U, F: FnMut(Self::Item) -> U>(self, function: F) -> Map<Self, F>

Creates non-empty iterators that map the items of the non-empty iterator with the function. Read more
Source§

fn max(self) -> Self::Item
where Self::Item: Ord,

Returns the maximum item of the non-empty iterator. Read more
Source§

fn max_by<F: FnMut(&Self::Item, &Self::Item) -> Ordering>( self, function: F, ) -> Self::Item

Returns the maximum item of the non-empty iterator with respect to the comparison function. Read more
Source§

fn max_by_key<K: Ord, F: FnMut(&Self::Item) -> K>( self, function: F, ) -> Self::Item

Returns the maximum item of the non-empty iterator with respect to the key function. Read more
Source§

fn min(self) -> Self::Item
where Self::Item: Ord,

Returns the minimum item of the non-empty iterator. Read more
Source§

fn min_by<F: FnMut(&Self::Item, &Self::Item) -> Ordering>( self, function: F, ) -> Self::Item

Returns the minimum item of the non-empty iterator with respect to the comparison function. Read more
Source§

fn min_by_key<K: Ord, F: FnMut(&Self::Item) -> K>( self, function: F, ) -> Self::Item

Returns the minimum item of the non-empty iterator with respect to the key function. Read more
Source§

fn nth(self, n: Size) -> Option<Self::Item>

Returns the n-th item of the non-empty iterator. Read more
Source§

fn skip(self, count: Size) -> Skip<Self::IntoIter>

Skips the first given number of items in the non-empty iterator. Read more
Source§

fn take(self, count: Size) -> Take<Self>

Takes only the first given number of items from the non-empty iterator. Read more
Source§

fn last(self) -> Self::Item

Returns the last item of the non-empty iterator. Read more
Source§

fn step_by(self, step: Size) -> StepBy<Self>

Steps the non-empty iterator by the given custom amount. Read more
Source§

fn for_each<F: FnMut(Self::Item)>(self, function: F)

Equivalent to for_each on Iterator.
Source§

fn exhaust(self)

Consumes the iterator, exhausting it by dropping all of its items. Read more
Source§

fn skip_while<P: FnMut(&Self::Item) -> bool>( self, predicate: P, ) -> SkipWhile<Self::IntoIter, P>

Equivalent to skip_while on Iterator. Read more
Source§

fn take_while<P: FnMut(&Self::Item) -> bool>( self, predicate: P, ) -> TakeWhile<Self::IntoIter, P>

Equivalent to take_while on Iterator. Read more
Source§

fn map_while<T, P: FnMut(Self::Item) -> Option<T>>( self, predicate: P, ) -> MapWhile<Self::IntoIter, P>

Equivalent to map_while on Iterator. Read more
Source§

fn scan<S, T, F: FnMut(&mut S, Self::Item) -> Option<T>>( self, initial: S, function: F, ) -> Scan<Self::IntoIter, S, F>

Equivalent to scan on Iterator. Read more
Source§

fn inspect<F: FnMut(&Self::Item)>(self, function: F) -> Inspect<Self, F>

Creates non-empty iterators that call the provided function with references to each item. Read more
Source§

fn partition<C: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool>( self, function: F, ) -> (C, C)

Equivalent to partition on Iterator.
Source§

fn position<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> Option<usize>

Equivalent to position on Iterator.
Source§

fn cmp<I: IntoIterator<Item = Self::Item>>(self, other: I) -> Ordering
where Self::Item: Ord,

Equivalent to cmp on Iterator.
Source§

fn partial_cmp<I: IntoIterator>(self, other: I) -> Option<Ordering>
where Self::Item: PartialOrd<I::Item>,

Equivalent to partial_cmp on Iterator.
Source§

fn eq<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialEq<I::Item>,

Equivalent to eq on Iterator.
Source§

fn ne<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialEq<I::Item>,

Equivalent to ne on Iterator.
Source§

fn lt<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialOrd<I::Item>,

Equivalent to lt on Iterator.
Source§

fn le<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialOrd<I::Item>,

Equivalent to le on Iterator.
Source§

fn gt<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialOrd<I::Item>,

Equivalent to gt on Iterator.
Source§

fn ge<I: IntoIterator>(self, other: I) -> bool
where Self::Item: PartialOrd<I::Item>,

Equivalent to ge on Iterator.
Source§

fn is_sorted(self) -> bool
where Self::Item: PartialOrd,

Equivalent to is_sorted on Iterator.
Source§

fn is_sorted_by<F: FnMut(&Self::Item, &Self::Item) -> bool>( self, function: F, ) -> bool

Equivalent to is_sorted_by on Iterator.
Source§

fn is_sorted_by_key<K: PartialOrd, F: FnMut(Self::Item) -> K>( self, function: F, ) -> bool

Equivalent to is_sorted_by_key on Iterator.
Source§

fn collect_into<C: Extend<Self::Item>>(self, collection: &mut C) -> &mut C

Similar to collect, but extends the provided collection instead of creating new ones. Read more
Source§

fn find_map<T, F: FnMut(Self::Item) -> Option<T>>( self, function: F, ) -> Option<T>

Equivalent to find_map on Iterator.
Source§

fn fuse(self) -> Fuse<Self>

Fuses the non-empty iterator, ensuring that once it returns None, it will return None forever afterwards. Read more
Source§

fn rev(self) -> Rev<Self>

Reverses the iteration in non-empty iterators. Read more
Source§

fn cycle(self) -> Cycle<Self>
where Self::IntoIter: Clone,

Repeats the non-empty iterator endlessly. Read more

Auto Trait Implementations§

§

impl<I> Freeze for Fuse<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for Fuse<I>
where I: RefUnwindSafe,

§

impl<I> Send for Fuse<I>
where I: Send,

§

impl<I> Sync for Fuse<I>
where I: Sync,

§

impl<I> Unpin for Fuse<I>
where I: Unpin,

§

impl<I> UnwindSafe for Fuse<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<I> IntoNonEmptyIterator for I

Source§

type IntoNonEmptyIter = I

What kind of NonEmptyIterator are we turning this into?
Source§

fn into_non_empty_iter(self) -> <I as IntoNonEmptyIterator>::IntoNonEmptyIter

Converts self into NonEmptyIterator.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<I> TryIntoNonEmptyIterator for I
where I: IntoIterator,

Source§

type Item = <I as IntoIterator>::Item

The type of the items being iterated over.
Source§

type IntoNonEmptyIter = NonEmptyAdapter<Peekable<<I as IntoIterator>::IntoIter>>

Which kind of NonEmptyIterator are we turning this into?
Source§

fn try_into_non_empty_iter( self, ) -> Option<<I as TryIntoNonEmptyIterator>::IntoNonEmptyIter>

Tries to convert self into NonEmptyIterator. Read more