Function fmty::cond_option

source ·
pub fn cond_option<T>(option: Option<T>) -> Cond<T>
Expand description

Conditionally writes an Option.

This is has the same behavior as concat(option) without the Clone requirement.

Examples

assert_eq!(fmty::cond_option(Some("hola")).to_string(), "hola");
assert_eq!(fmty::cond_option(None::<&str>).to_string(), "");