ternary

Macro ternary 

Source
macro_rules! ternary {
    ($condition:expr, $value_true:expr, $value_false:expr) => { ... };
}
Expand description

A macro for ternary conditional operation(wiki) in rust.

This macro evaluates a condition and returns one of two expressions based on whether the condition is true or false.

ยงExamples:

 use macrors::ternary;

 let x = 5;
 let y = 10;

 let result = ternary!(x < y, "x is less than y", "x is not less than y");
 assert_eq!(result, "x is less than y");