pub struct Display2Format<'a, T: Display + ?Sized>(pub &'a T);
Expand description
An “adapter” type to feed Display
values into defmt macros, which expect defmt::Format
values.
This adapter disables compression and uses the core::fmt
code on-device! You should prefer
defmt::Format
over Display
whenever possible.
§Examples
defmt::info!("{}", defmt::Display2Format(&expensive_thing));
// ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ
// must implement `fmt::Display`
Note that any provided defmt display hints will be ignored
because this always uses {}
to format the contained value.
Tuple Fields§
§0: &'a T
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Display2Format<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for Display2Format<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> Send for Display2Format<'a, T>
impl<'a, T> Sync for Display2Format<'a, T>
impl<'a, T> Unpin for Display2Format<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for Display2Format<'a, T>where
T: RefUnwindSafe + ?Sized,
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