Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/wasip1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
}