iter_accumulate 1.0.1

An iterator adaptor that accumulates the elements and yields the current accumulated value for each iteration
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 4 items with examples
  • Size
  • Source code size: 17.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.69 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • nelsbrock/iter_accumulate
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nelsbrock

iter_accumulate

An iterator adaptor for Rust that accumulates the elements from the base iterator using the provided closure.

Example

use iter_accumulate::IterAccumulate;

let input = [1, 2, 3, 4, 5];
let mut iter = input.iter().accumulate(1, |acc, i| acc * i);

assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), Some(6));
assert_eq!(iter.next(), Some(24));
assert_eq!(iter.next(), Some(120));
assert_eq!(iter.next(), None);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.