iter-flow 0.1.0

Functional programming utilities for Rust
Documentation
  • Coverage
  • 100%
    21 out of 21 items documented10 out of 14 items with examples
  • Size
  • Source code size: 40.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.81 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • lasantosr/iter-flow-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lasantosr

Iterflow

Functional programming utilities for Rust.

This crate is heavily inspired by itertools but with the main focus of chaining operations to develop in a declarative approach (as opposed to usual imperative)

fn sub_1(n: u32) -> Result<u32, &'static str> {
    if n == 0 { Err("illegal!") } else { Ok(n - 1) }
}

fn math_calc(n: u32) -> u32 {
    (n + 1) * 2
}

fn to_range(n: u32) -> Range<u32> {
    0..n
}

let it = (0..4)
    .map(sub_1)
    .and_then(sub_1)
    .map_ok(math_calc)
    .flat_map_ok(to_range);

iter_flow::assert_equal(
    it,
    vec![
        Err("illegal!"),
        Err("illegal!"),
        Ok(0),
        Ok(1),
        Ok(0),
        Ok(1),
        Ok(2),
        Ok(3),
    ],
);

TODO:

  • Support for async/await with Futures

License

Iterflow is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.