浏览代码

multiboot2: TagTypeId: better debug impl

Philipp Schuster 1 年之前
父节点
当前提交
678c40b182
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      multiboot2/src/tag_type.rs

+ 8 - 1
multiboot2/src/tag_type.rs

@@ -19,7 +19,7 @@ use core::str::Utf8Error;
 /// Multiboot2 [`Tag`]. This type can easily be created from or converted to
 /// [`TagType`].
 #[repr(transparent)]
-#[derive(Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Hash)]
+#[derive(Copy, Clone, PartialOrd, PartialEq, Eq, Ord, Hash)]
 pub struct TagTypeId(u32);
 
 impl TagTypeId {
@@ -29,6 +29,13 @@ impl TagTypeId {
     }
 }
 
+impl Debug for TagTypeId {
+    fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
+        let tag_type = TagType::from(*self);
+        Debug::fmt(&tag_type, f)
+    }
+}
+
 /// Higher level abstraction for [`TagTypeId`] that assigns each possible value
 /// to a specific semantic according to the specification. Additionally, it
 /// allows to use the [`TagType::Custom`] variant. It is **not binary compatible**