Skip to main content

TryIntoNonEmptyIterator

Trait TryIntoNonEmptyIterator 

Source
pub trait TryIntoNonEmptyIterator: Sealed {
    type Item;
    type IntoNonEmptyIter: NonEmptyIterator<Item = Self::Item>;

    // Required method
    fn try_into_non_empty_iter(self) -> Option<Self::IntoNonEmptyIter>;
}
Expand description

Convenience trait implemented for any type that is IntoIterator, allowing to convert iterables into non-empty ones.

Required Associated Types§

Source

type Item

The type of the items being iterated over.

Source

type IntoNonEmptyIter: NonEmptyIterator<Item = Self::Item>

Which kind of NonEmptyIterator are we turning this into?

Required Methods§

Source

fn try_into_non_empty_iter(self) -> Option<Self::IntoNonEmptyIter>

Tries to convert self into NonEmptyIterator.

Returns None if self is empty and therefore can not be converted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§