6 releases
0.2.3 | Sep 8, 2024 |
---|---|
0.2.2 | Sep 8, 2024 |
0.2.1 | Feb 19, 2024 |
0.2.0 | Jun 24, 2023 |
0.0.1 | Dec 11, 2022 |
#430 in Rust patterns
3,872 downloads per month
Used in 12 crates
(5 directly)
10KB
126 lines
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