iterware 0.1.0

Simple middleware for iterators
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented1 out of 3 items with examples
  • Size
  • Source code size: 8.42 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.02 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Spaceface16518/iterator-middleware
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Spaceface16518

Iterware

Simple middleware for Rust iterators

Just a small package, mostly for debugging purposes. Most common use would be easily printing each value in an iterator as it passes.

Think of it like a for_each adapter that doesn't change or consume the values of the iterator.

Usage

Simply import the IteratorMiddleware trait

extern crate iterware; // Not really necessary

use iterware::IteratorMiddleware;

and use method chaining to add middleware to your iterators

fn sum(values: Vec<i32>) -> i32 {
    // Type annotations added for clarity
    values
        .into_iter()
        .middleware(|value: &i32| println!("Adding value {}", value))
        .sum::<i32>()
}