pub const fn fmt_display<T>(value: T) -> FmtDisplay<T>where
T: Display,Expand description
Creates an object that Debug or Display a value based on its Display implementation.
Example:
use std::fmt::{self, Display, Formatter};
struct Foo;
impl Display for Foo {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.write_str("foo")
}
}
let fmt = fmt_tools::fmt_display(Foo);
assert_eq!(format!("{fmt:?}"), "foo");
assert_eq!(format!("{fmt}"), "foo");