Function fmty::cond_or

source ·
pub fn cond_or<T, U>(write: bool, value: T, fallback: U) -> CondOr<T, U>
Expand description

Conditionally writes a value, or its fallback if false.

Examples

assert_eq!(fmty::cond_or(true,  "hola", "mundo").to_string(), "hola");
assert_eq!(fmty::cond_or(false, "hola", "mundo").to_string(), "mundo");