either!() { /* proc-macro */ }
Expand description

Ternary operator in many C-like languages.

either!(expr ? left : right) expand to if expr { left } else { right }.

Example

use helper::either;

assert_eq!(either!(1 > 2 ? "1" : "2"), "2");