logo
pub struct Debug2Format<'a, T: Debug + ?Sized>(pub &'a T);
Expand description

An “adapter” type to feed Debug 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 Debug whenever possible.

Examples

defmt::info!("{:?}", defmt::Debug2Format(&expensive_thing));
//                                        ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ
//                                        must `#[derive(Debug)]`

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

Writes the defmt representation of self to fmt.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.