Skip to main content

IteratorIdentifyFirstLastExt

Trait IteratorIdentifyFirstLastExt 

Source
pub trait IteratorIdentifyFirstLastExt: Iterator + Sized {
    // Required methods
    fn identify_first(self) -> IdentifyFirst<Self> ;
    fn identify_last(self) -> IdentifyLast<Self> ;
    fn identify_first_last(self) -> IdentifyFirstLast<Self> ;
}
Expand description

Extends Iterator with methods for marking first and last elements with boolean flags.

Required Methods§

Source

fn identify_first(self) -> IdentifyFirst<Self>

Creates an iterator which gives the is_first flag as well as the next value.

The iterator returned yields pairs (is_first, val), where is_first is the boolean which is true for the first element and false for the others, and val is the value returned by the iterator.

Source

fn identify_last(self) -> IdentifyLast<Self>

Creates an iterator which gives the is_last flag as well as the next value.

The iterator returned yields pairs (is_last, val), where is_last is the boolean which is true for the last element and false for the others, and val is the value returned by the iterator.

Source

fn identify_first_last(self) -> IdentifyFirstLast<Self>

Creates an iterator which gives the is_first and is_last flags as well as the next value.

The iterator returned yields triples (is_first, is_last, val), where is_first is the boolean which is true for the first element and false for the others, is_last is the boolean which is true for the last element and false for the others, and val is the value returned by the iterator.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§