macro_rules! ternary { ($condition:expr, $value_true:expr, $value_false:expr) => { ... }; }
Expand description
[ternary]
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");