pub fn fmt_with<F: Fn(&mut Formatter<'_>) -> Result>(fmt: F) -> FmtWith<F>
Expand description
Formats via a closure.
Examples
let value = Some("hola mundo");
let formatted = fmty::fmt_with(|f| {
if let Some(value) = value {
write!(f, "{value}")?;
}
Ok(())
});
assert_eq!(formatted.to_string(), "hola mundo");