enumerate-split 0.0.1

2 dimensional version of Enumerate from the standard library
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented1 out of 2 items with examples
  • Size
  • Source code size: 4.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.08 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Documentation
  • richard-uk1/enumerate-split
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • richard-uk1

enumerate-split

Like enumerate, but splits into blocks based on some value (like '\n' for lines) and gives the block number and the block position as (usize, usize)

documentation

Usage

[dependencies]
enumerate-split = "0.0.1"

Example

use enumerate_split::enumerate_split;

let mut input = enumerate_split("Some \n\nstring with a newline".chars(), '\n');
assert_eq!(input.next(), Some(('S', (0, 0))));
assert_eq!(input.next(), Some(('o', (0, 1))));
assert_eq!(input.next(), Some(('m', (0, 2))));
assert_eq!(input.next(), Some(('e', (0, 3))));
assert_eq!(input.next(), Some((' ', (0, 4))));
assert_eq!(input.next(), Some(('\n', (0, 5))));
assert_eq!(input.next(), Some(('\n', (1, 0))));
assert_eq!(input.next(), Some(('s', (2, 0))))