#first #last #iterator #is-last

no-std iter-identify_first_last

A helper iterator, flagging first and last elements

4 releases (2 breaking)

0.2.1 Feb 19, 2024
0.2.0 Jun 24, 2023
0.1.0 Dec 26, 2022
0.0.1 Dec 11, 2022

#643 in Rust patterns

Download history 7/week @ 2024-02-02 223/week @ 2024-02-09 367/week @ 2024-02-16 303/week @ 2024-02-23 193/week @ 2024-03-01 297/week @ 2024-03-08 229/week @ 2024-03-15 247/week @ 2024-03-22 268/week @ 2024-03-29 266/week @ 2024-04-05 246/week @ 2024-04-12 239/week @ 2024-04-19 198/week @ 2024-04-26 184/week @ 2024-05-03 147/week @ 2024-05-10

802 downloads per month
Used in 6 crates (5 directly)

MIT/Apache

10KB
125 lines

maintenance: actively developed

iter-identify_first_last

A helper iterator, flagging first and last elements.

use iter_identify_first_last::IteratorIdentifyFirstLastExt;
use std::fmt::Write;

fn main() {
    let list = [1, 2, 3, 4, 5, 6];
    let mut string = String::new();
    for (is_first, item) in list.iter().identify_first() {
        if !is_first {
            string.push(' ');
        }
        write!(string, "{item}").unwrap();
    }
    assert_eq!(string, "1 2 3 4 5 6");
}

lib.rs:

Feature flags

Dependencies

~175KB