Skip to main content

or_dash

Function or_dash 

Source
pub fn or_dash<T: Display>(value: Option<T>) -> impl Display
Expand description

Formats an optional log field: the value itself, or ABSENT.

assert_eq!(or_dash(Some("h3")).to_string(), "h3");
assert_eq!(or_dash(None::<&str>).to_string(), "-");