chain-one

Crates.iochain-one
lib.rschain-one
version0.1.0
sourcesrc
created_at2019-03-27 12:21:15.307861
updated_at2019-03-27 12:21:15.307861
descriptionA way to add a single element to an iterator while preserving `ExactSizeIterator`
homepage
repository
max_upload_size
id124149
size3,384
Eira Fransham (eira-fransham)

documentation

README

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]);
Commit count: 0

cargo fmt