macro_rules! fmt {
($fmt:literal $($rest:tt)*) => { ... };
($fn:expr) => { ... };
}Expand description
Like format_args! or fmt_with()
depending on usage.
This macro accepts either a formatting arguments or a closure. It is similar
to format::lazy_format!
with the added benefit of being a declarative macro rather than a procedural
macro.
This always returns
FmtWith<impl Fn(&mut Formatter) -> Result>.
ยงExamples
let a = fmty::fmt!("hola");
let b = fmty::fmt!("{}", "hola");
let c = fmty::fmt!(|f| f.write_str("hola"));
assert_eq!(a.to_string(), b.to_string());
assert_eq!(a.to_string(), c.to_string());