wasmtime
wasmtime copied to clipboard
add linker to wasi preview2 that accepts custom closure
Allow passing of closure to wasi command linking. Current add_to_linker is re-implemented more general API. Without this, it's hard to create reusable wasi context store
Thanks for the PR, but this is something we were ideally hoping to avoid with the WasiView trait design. Would it be possible to implement WasiView for your type T within the Store<T>?
Issue is that T is becoming very complex. Ideally Store should be composable. Key problem is that store is tied to linker which makes difficult separate host implementation
I understand that T can be complex, and I also understand that writing a closure is shorter than writing a trait impl, but I'm not sure why the complexity would make trait impls more difficult (as opposed to a simple T). The fact that the store and linker are tied together is indeed a bit limiting, but with trait bounds it should be possible to design roughly the sme APIs.
Is there anything preventing the trait impls on T in your case?
We chattec a bit more tonight about this and I think it's a reasonable enough feature to add given it's pretty small and solves a concrete use case. If you're ok fixing the failing test on CI (I think there's a new trait bound needed) I can r+
Thanks. Will fix CI