pub struct ComprehensiveFmt<Fmt>(pub Fmt)
where
Fmt: Fn(&mut Formatter<'_>) -> Result;
Expand description
Implements all format traits by calling the stored closure.
§Example
use fn_formats::ComprehensiveFmt;
let comprehensive = ComprehensiveFmt(|f| write!(f, "fmt"));
assert_eq!(format!("{:b}", comprehensive), "fmt");
assert_eq!(format!("{:?}", comprehensive), "fmt");
assert_eq!(format!("{}", comprehensive), "fmt");
assert_eq!(format!("{:e}", comprehensive), "fmt");
assert_eq!(format!("{:x}", comprehensive), "fmt");
assert_eq!(format!("{:o}", comprehensive), "fmt");
assert_eq!(format!("{:p}", comprehensive), "fmt");
assert_eq!(format!("{:E}", comprehensive), "fmt");
assert_eq!(format!("{:X}", comprehensive), "fmt");
Tuple Fields§
§0: Fmt
Trait Implementations§
Source§impl<Fmt> Clone for ComprehensiveFmt<Fmt>
impl<Fmt> Clone for ComprehensiveFmt<Fmt>
Source§fn clone(&self) -> ComprehensiveFmt<Fmt>
fn clone(&self) -> ComprehensiveFmt<Fmt>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<Fmt> Default for ComprehensiveFmt<Fmt>
impl<Fmt> Default for ComprehensiveFmt<Fmt>
Source§fn default() -> ComprehensiveFmt<Fmt>
fn default() -> ComprehensiveFmt<Fmt>
Returns the “default value” for a type. Read more
Source§impl<Fmt: Fn(&mut Formatter<'_>) -> Result> From<Fmt> for ComprehensiveFmt<Fmt>
let _: fn_formats::ComprehensiveFmt<_> = (|f: &mut core::fmt::Formatter| Ok(())).into();
impl<Fmt: Fn(&mut Formatter<'_>) -> Result> From<Fmt> for ComprehensiveFmt<Fmt>
let _: fn_formats::ComprehensiveFmt<_> = (|f: &mut core::fmt::Formatter| Ok(())).into();
Source§impl<Fmt> Hash for ComprehensiveFmt<Fmt>
impl<Fmt> Hash for ComprehensiveFmt<Fmt>
Source§impl<Fmt> Ord for ComprehensiveFmt<Fmt>
impl<Fmt> Ord for ComprehensiveFmt<Fmt>
Source§fn cmp(&self, other: &ComprehensiveFmt<Fmt>) -> Ordering
fn cmp(&self, other: &ComprehensiveFmt<Fmt>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Fmt> PartialEq for ComprehensiveFmt<Fmt>
impl<Fmt> PartialEq for ComprehensiveFmt<Fmt>
Source§impl<Fmt> PartialOrd for ComprehensiveFmt<Fmt>
impl<Fmt> PartialOrd for ComprehensiveFmt<Fmt>
impl<Fmt> Copy for ComprehensiveFmt<Fmt>
impl<Fmt> Eq for ComprehensiveFmt<Fmt>
impl<Fmt> StructuralPartialEq for ComprehensiveFmt<Fmt>
Auto Trait Implementations§
impl<Fmt> Freeze for ComprehensiveFmt<Fmt>where
Fmt: Freeze,
impl<Fmt> RefUnwindSafe for ComprehensiveFmt<Fmt>where
Fmt: RefUnwindSafe,
impl<Fmt> Send for ComprehensiveFmt<Fmt>where
Fmt: Send,
impl<Fmt> Sync for ComprehensiveFmt<Fmt>where
Fmt: Sync,
impl<Fmt> Unpin for ComprehensiveFmt<Fmt>where
Fmt: Unpin,
impl<Fmt> UnwindSafe for ComprehensiveFmt<Fmt>where
Fmt: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more