nll_rs

Macro compose

Source
macro_rules! compose {
    ( $last:expr ) => { ... };
    ( $head:expr, $($tail:expr), +) => { ... };
}
Expand description

Composes any number of functions

ยงExample

use crate::nll_rs::*;

let composed_fn = compose!(|x| x + 1, |x| x * 2, |x: i32| x.pow(2));

assert_eq!(composed_fn(1), 16);

println!("{}", composed_fn(1));