Crates.io | pipe_macro |
lib.rs | pipe_macro |
version | 0.1.0 |
source | src |
created_at | 2020-05-05 15:40:06.471297 |
updated_at | 2020-05-05 15:40:06.471297 |
description | A macro to pipe function calls like in functional programming languages. |
homepage | |
repository | |
max_upload_size | |
id | 237767 |
size | 5,895 |
This crate provides a macro to pipe function calls like in some functional programming languages.
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);