5 stable releases
1.2.1 | Apr 12, 2021 |
---|---|
1.1.0 | Apr 12, 2021 |
1.0.1 | Apr 12, 2021 |
#3 in #depending
Used in timetracking
6KB
iif
Returns one of two parts, depending on the evaluation of an expression.
Straight form the days of VBA programming, now available in rust!
Examples
Use iif to decide between two values depending on a boolean expression.
use iif::iif;
let active = true;
let active_text = iif!(active, "Active", "Inactive");
assert_eq!(active_text, "Active");
Use iif_opt to create an Option
depending on a boolean expression.
use iif::iif_opt;
let active = true;
let active_text = iif_opt!(active, "Active");
assert_eq!(active_text, Some("Active"));