Stream: git-wasmtime

Topic: wasmtime / issue #1018 Support creating a set of imports ...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 10 2021 at 23:48):

alexcrichton commented on issue #1018:

This was fixed in the recently redesigned API

view this post on Zulip Wasmtime GitHub notifications bot (Jun 10 2021 at 23:48):

alexcrichton closed issue #1018:

One thing the current wasmtime::Func API isn't great at is sometimes (for example with WASI) you want to create a set of functions that all share the same piece of state. Sort of like a trait that has a bunch of functions on it. This is possible today but it involves manually creating a lot of Func instances and explicitly using Rc to share state between each import.

It'd be nicer if we could explore possibly alternative ways of doing this. For example if we had like a FuncBuilder<T> where you passed it Fn(&T, Args...) -> R and it handed back a Func. That might make it easier to have shared state amongst a set of functions without having to manually deal with all the clunky Rc allocations.

To be clear I think this is basically about expressiveness, I believe everything should already be possible that needs to get done today. This may be more optimizable by the API as well, but we'd have to measure!


Last updated: Nov 22 2024 at 16:03 UTC