I'm updating some old code which used the preview2-prototyping crates to use wasm components, and it seems like I now need to implement WasiView
for a context: <https://github.com/bytecodealliance/preview2-prototyping/blob/main/host/src/main.rs#L96>
I also see the Table
has been introduced as a requirement too. Sadly these types have no code docs yet.
What is WasiView and the table used for exactly?
hi, yes, all of that code does need new docs written
in short the explanation is: previously, WasiCtx owned a Table, so it was just an implementation detail never exposed to the user
its still an implementation detail - the user shouldnt ever have to interact with table directly, WasiCtxBuilder and WasiView should take care of it - but we needed to enable sharing the same Table across many different crates implementing different chunks of wasi preview 2
so, the user is responsible for creating one single Table, using it to build their WasiCtx as well as any other ctxs that need it, and then making it a member of their T
in Store<T>
struct, and providing WasiView impl on that T
if you take a look in host/src/main.rs or host/tests/command.rs you can see examples of how this should look
and i suppose we can package in a more convenient version of that
Ari Seyhun has marked this topic as resolved.
Last updated: Dec 23 2024 at 13:07 UTC