mark_last 0.9.2

Simple extension to rust iterator's to mark the last element of an iterator
Documentation
  • Coverage
  • 50%
    2 out of 4 items documented1 out of 3 items with examples
  • Size
  • Source code size: 4.33 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 461.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • mrcz/mark_last
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mrcz

mark_last

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.

Usage

Add mark_last = "0.9.2" to the dependencies section of your Cargo.toml file, and use it like so:

use mark_last::MarkLastIterator;

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)
    ]
)