From cc62a8f6b5e7efc4b4e4aa9118dac15ea688528b Mon Sep 17 00:00:00 2001 From: Jonathan 'theJPster' Pallant Date: Fri, 11 Oct 2024 20:06:01 +0200 Subject: [PATCH] Improve debug print for Handle. It's obvious it's a handle from context, so just print the inner value. And print it as hex because it might be large. --- src/filesystem/handles.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/filesystem/handles.rs b/src/filesystem/handles.rs index 3fd9608..dd37903 100644 --- a/src/filesystem/handles.rs +++ b/src/filesystem/handles.rs @@ -2,11 +2,17 @@ use core::num::Wrapping; -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "defmt-log", derive(defmt::Format))] /// Unique ID used to identify things in the open Volume/File/Directory lists pub struct Handle(pub(crate) u32); +impl core::fmt::Debug for Handle { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{:#08x}", self.0) + } +} + /// A Handle Generator. /// /// This object will always return a different ID.