Function fmty::cond_with

source ·
pub fn cond_with<R, F>(write: bool, f: F) -> CondWith<Option<F>>where
    F: Fn() -> R,
Expand description

Conditionally writes a closure result.

Examples

assert_eq!(fmty::cond_with(true,  || "hola").to_string(), "hola");
assert_eq!(fmty::cond_with(false, || "hola").to_string(), "");