| 1 | //! Defmt implementations for heapless types |
|---|---|
| 2 | //! |
| 3 | |
| 4 | use crate::Vec; |
| 5 | use defmt::Formatter; |
| 6 | |
| 7 | impl<T, const N: usize> defmt::Format for Vec<T, N> |
| 8 | where |
| 9 | T: defmt::Format, |
| 10 | { |
| 11 | fn format(&self, fmt: Formatter<'_>) { |
| 12 | defmt::write!(fmt, "{=[?]}", self.as_slice()) |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | impl<const N: usize> defmt::Format for crate::String<N> |
| 17 | where |
| 18 | u8: defmt::Format, |
| 19 | { |
| 20 | fn format(&self, fmt: Formatter<'_>) { |
| 21 | defmt::write!(fmt, "{=str}", self.as_str()); |
| 22 | } |
| 23 | } |
| 24 |
