chain-one 0.1.0

A way to add a single element to an iterator while preserving `ExactSizeIterator`
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 3 items with examples
  • Size
  • Source code size: 3.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.19 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • eira-fransham

chain_one

Annoyed that you [T; N] doesn't implement IntoIterator<Item = T>? Annoyed that Chain doesn't implement ExactSizeIterator? Do I have a project for you!

assert_eq!(iter![1, 2, 3, 4, 5].collect::<Vec<_>>(), vec![1, 2, 3, 4, 5]);
assert_eq!(iter![1, 2, 3, 4, 5].rev().collect::<Vec<_>>(), vec![5, 4, 3, 2, 1]);
assert_eq!((0..5).chain_one(0).collect::<Vec<_>>(), vec![0, 1, 2, 3, 4, 0]);