[][src]Trait mark_last::MarkLastIterator

pub trait MarkLastIterator<I: Iterator> {
    pub fn mark_last(self) -> MarkLast<I>

Notable traits for MarkLast<I>

impl<I: Iterator> Iterator for MarkLast<I> type Item = (bool, I::Item);
; }

Required methods

pub fn mark_last(self) -> MarkLast<I>

Notable traits for MarkLast<I>

impl<I: Iterator> Iterator for MarkLast<I> type Item = (bool, I::Item);
[src]

Creates an iterator which gives the next value as well as a boolean indicating if this is the last value of the iterator.

The iterator returned yields pairs (b, val), where b is true if this is the last value and val is the value returned by the iterator.

Examples

let in_data = vec![1, 2, 3, 5, 99];
let out_data: Vec<_> = in_data.into_iter().mark_last().collect();
assert_eq!(
    out_data,
    vec![(false, 1), (false, 2), (false, 3), (false, 5), (true, 99)]
);
Loading content...

Implementors

impl<I: Iterator> MarkLastIterator<I> for I[src]

Loading content...