From df032366950f67a29dfdc47a77724f67e37899ad Mon Sep 17 00:00:00 2001 From: oligami Date: Thu, 2 Apr 2026 10:59:08 +0900 Subject: [PATCH] Implement the missing debug functionality --- crates/wasip1/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/wasip1/src/lib.rs b/crates/wasip1/src/lib.rs index 0df207b6..2d9e448a 100644 --- a/crates/wasip1/src/lib.rs +++ b/crates/wasip1/src/lib.rs @@ -45,3 +45,13 @@ pub const FD_STDOUT: Fd = 1; /// The "standard error" descriptor number. pub const FD_STDERR: Fd = 2; + +/// Implement `Debug` for `Prestat` by matching on the `tag` field and formatting the appropriate variant. +impl core::fmt::Debug for Prestat { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self.tag { + 0 => f.debug_tuple("PrestatDir").field(unsafe { &self.u.dir }).finish(), + _ => f.debug_tuple("PrestatUnknown").field(&self.tag).finish(), + } + } +}