Stream: general

Topic: Resource and ResourceTable on a wasmtime host


view this post on Zulip Tom (Jun 02 2025 at 10:21):

Hi. y'all! For the life of me, I can't figure out how to manage resources. For example, wasmtime_wasi seems to return Resource of whatever it wants here. But in my bindgen results, it wants me to return a Resource of an empty enum type. And I can make my own ResourceTable to store whatever I want in, but if I return my own separate Resource of the empty enum type, the bindgen code seems to invent its own new handle numbers separate from mine. And maybe I just failed to read the right docs or find any simple examples, but I'm failing bad here. And I'm not sure if any of these options are useful or helpful at all. Thanks for any help!

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant - bytecodealliance/wasmtime

view this post on Zulip Tom (Jun 02 2025 at 10:25):

And of course, right after I post is when I find this example.

view this post on Zulip mainrs (Jun 05 2025 at 09:37):

Did you figure your issue out? Pretty sure it's the missing with statement that binds the resource to an actual implementation type. If not specified, wit-bindgen creates an empty enum.


Last updated: Dec 06 2025 at 05:03 UTC