Skip to content

Commit

Permalink
Improve debug print for Handle.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thejpster committed Oct 11, 2024
1 parent fe05b9f commit cc62a8f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/filesystem/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cc62a8f

Please sign in to comment.