pipa 0.2.1

Pipe Operator Library
Documentation

pipa

Pipe Operator Library for Rust.

Features:

  • Pipe things into chain of functions.
  • Support different types.
  • Support pipe for Try-able types(Option & Result)
  • Support pipe for async-await with Try-able types(Option & Result)

Example:

fn f(a: i32) -> u64 {
    (a + 1) as u64
}

fn g(a: u64) -> String {
    (a + 1).to_string()
}

fn h(s: String) -> u64 {
    let ret = s.parse::<u64>();
    ret.unwrap() + 10
}

#[test]
fn pipe() {
    let ret = pipa!(123 => f => g => h);
    assert_eq!(135, ret);
}

More examples are in tests/test.rs.