Macro macro_utils::tern_haskell[][src]

macro_rules! tern_haskell {
    (if ($cond:expr) then { $if_expr:expr } else { $else_expr:expr }) => { ... };
}

You miss Haskell-like ternary conditions? Why not having them in Rust then?

let y = 4;
let x = tern_haskell! { if (y & 1 == 0) then { "it's even" } else { "it's odd" } };

println!("{} is {}", y, x);