Is there any functionality provided that allows overriding snapshot preview 1 implementation?
I see that the implementation is provided for WasiCtx
https://github.com/bytecodealliance/wasmtime/blob/8c9c72caaac6f7a21f031f274c87eb26ac630ca7/crates/wasi-common/src/snapshots/preview_1.rs#L194-L1182
Obvious approach with wrapping WasiCtx
into a custom struct implementing the trait and using that context instead does not seem to work, in particular because add_to_linker
expects a getter returning a WasiCtx
struct https://github.com/bytecodealliance/wasmtime/blob/7a1b7cdf92a644a256a9f4c5c002682e1900d817/crates/wasi/src/lib.rs#L47
linker.func_wrap("wasi_snapshot_preview1"...
approach seems to break the runtime, but I have to explore this option more.
Regardless, it would be beneficial to have an implementable trait here.
Would refactoring add_to_linker
closure signature return type to use a trait instead be an acceptable way forward?
Any suggestions, ideas?
Filed https://github.com/bytecodealliance/wasmtime/pull/3895
Last updated: Dec 23 2024 at 14:03 UTC