Stream: wasmtime

Topic: wasmtime-wit-bindgen resources status


view this post on Zulip Joel Dice (Sep 12 2023 at 16:29):

Is it accurate to say that wasmtime-wit-bindgen currently only supports host-implemented resources (i.e. the host exporting resources to the guest)? If so, is it possible to import resources from the guest by using wasmtime::component::resources directly (i.e. without binding generation), and are there any examples of doing that?
I'm working on implementing resource support in componentize-py and would like to test both directions.

view this post on Zulip Alex Crichton (Sep 12 2023 at 16:59):

Correct yeah, although supporting guest-defined resources shouldn't be too much of a leap from where it is already

view this post on Zulip Joel Dice (Sep 12 2023 at 17:48):

For the time being, it looks like I can call the guest resource's constructor like it's a regular exported function and then expect a wasmtime::component::values::Val::Resourceto be returned. Is that currently the best/only option?

view this post on Zulip Joel Dice (Sep 12 2023 at 17:55):

oh, I see now that ResourceAny implements ComponentType, so I can use the typed_func API

view this post on Zulip Alex Crichton (Sep 12 2023 at 19:08):

ah yeah all guest resources will be represented with ResourceAny


Last updated: Nov 22 2024 at 17:03 UTC