pipe_macro

Crates.iopipe_macro
lib.rspipe_macro
version0.1.0
sourcesrc
created_at2020-05-05 15:40:06.471297
updated_at2020-05-05 15:40:06.471297
descriptionA macro to pipe function calls like in functional programming languages.
homepage
repository
max_upload_size
id237767
size5,895
Josh Cooper (joshua-cooper)

documentation

README

pipe_macro

This crate provides a macro to pipe function calls like in some functional programming languages.

Examples

fn add(a: usize, b: usize) -> usize {
    a + b
}

fn double(a: usize) -> usize {
    a * 2
}

let answer = pipe!(
    2
    => double
    => { |n| add(n, 10) }
    => double
);

assert_eq!(answer, 28);
let count = pipe!("https://rust-lang.org" => download.await? => parse? => count_links);
Commit count: 0

cargo fmt