Crates.io | iif |
lib.rs | iif |
version | 1.2.1 |
source | src |
created_at | 2021-04-12 11:12:09.376153 |
updated_at | 2021-04-12 11:41:44.810444 |
description | Returns one of two parts, depending on the evaluation of an expression. |
homepage | |
repository | https://github.com/hardliner66/iif |
max_upload_size | |
id | 382342 |
size | 14,233 |
Returns one of two parts, depending on the evaluation of an expression.
Straight form the days of VBA programming, now available in rust!
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"));