Hexadecimal Debug format of Id

This commit is contained in:
Emil Ernerfeldt 2020-11-09 18:41:19 +01:00
parent e55b59256e
commit c999ed038a

View file

@ -27,7 +27,7 @@ use std::hash::Hash;
///
/// Then there are widgets that need no identifiers at all, like labels,
/// because they have no state nor are interacted with.
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
#[derive(Clone, Copy, Hash, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Id(u64);
@ -59,3 +59,9 @@ impl Id {
format!("{:04X}", self.0 as u16)
}
}
impl std::fmt::Debug for Id {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:X}", self.0)
}
}