alexcrichton opened PR #14356 from alexcrichton:refactor-metadata to bytecodealliance:main:
Avoid unwrapping structures into a shape only to re-wrap them later on into a WASI-defined shape. Instead remove various extension traits and shuffling of fields and instead use an
enumfor the definitions ofMetadataandFileTypewhich are either standard library types or rustix-based types. Accessors then delegate to the appropriate fields depending on how the data lies at rest.The goal here is to remove layer of cognitive indirection where there's a platform-specific source of truth for the underlying data. Accessors where a specific type is requested or a particular operation is where the interpretation of the underlying data happens then.
Note that the reason that
std::fs::Metadataalone isn't sufficient is that the Rust standard library doesn't bind functions likestatatand there's no way to create astd::fs::Metadataexternally from the standard library, hence the Unix-specific layer where metadata might bestd::fs::Metadataand might berustix::fs::Stat.prtest:full
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton edited PR #14356:
Avoid unwrapping structures into a shape only to re-wrap them later on into a WASI-defined shape. Instead remove various extension traits and shuffling of fields and instead use an
enumfor the definitions ofMetadataandFileTypewhich are either standard library types or rustix-based types. Accessors then delegate to the appropriate fields depending on how the data lies at rest.The goal here is to remove layer of cognitive indirection where there's a platform-specific source of truth for the underlying data. Accessors where a specific type is requested or a particular operation is where the interpretation of the underlying data happens then.
Note that the reason that
std::fs::Metadataalone isn't sufficient is that the Rust standard library doesn't bind functions likestatatand there's no way to create astd::fs::Metadataexternally from the standard library, hence the Unix-specific layer where metadata might bestd::fs::Metadataand might berustix::fs::Stat.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton updated PR #14356.
alexcrichton has marked PR #14356 as ready for review.
alexcrichton requested dicej for a review on PR #14356.
alexcrichton requested wasmtime-wasi-reviewers for a review on PR #14356.
github-actions[bot] added the label wasi on PR #14356.
Last updated: Sep 20 2026 at 18:08 UTC