[−][src]Crate fn_formats
This is a small shim library for passing closures where you need a format trait.
Example
use fn_formats::DebugFmt; let formattable = DebugFmt(|f| { f.debug_struct("StructName") .field("list", &DebugFmt(|f| f.debug_list().entries(&[1, 2, 3]).finish())) .field("set", &DebugFmt(|f| f.debug_set().entries(&[4, 5, 6]).finish())) .finish() }); assert_eq!(format!("{:?}", formattable), "StructName { list: [1, 2, 3], set: {4, 5, 6} }");
There are also From
implementations where applicable:
use fn_formats::ComprehensiveFmt; let _: ComprehensiveFmt<_> = (|f: &mut core::fmt::Formatter| Ok(())).into();
Structs
BinaryFmt | Implements |
ComprehensiveFmt | Implements all format traits by calling the stored closure. |
ComprehensiveFmtSeparate | Implements all format traits by calling the respective stored closure. |
DebugDisplayFmt | |
DebugDisplayFmtSeparate | Implements |
DebugFmt | Implements |
DisplayFmt | Implements |
LowerExpFmt | Implements |
LowerHexFmt | Implements |
OctalFmt | Implements |
PointerFmt | Implements |
UpperExpFmt | Implements |
UpperHexFmt | Implements |