A simple extension to rust iterators 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.
Add mark_last = "0.9.1"
to the dependencies section of your Cargo.toml file, and use it like so:
```rust use mark_last::MarkLastIterator;
let indata = vec![1, 2, 3, 5, 99]; let outdata: Vec<_> = indata.intoiter().marklast().collect(); asserteq!( out_data, vec![(false, 1), (false, 2), (false, 3), (false, 5), (true, 99)] ) ```