alexcrichton commented on issue #1018:
This was fixed in the recently redesigned API
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 ofFunc
instances and explicitly usingRc
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 itFn(&T, Args...) -> R
and it handed back aFunc
. That might make it easier to have shared state amongst a set of functions without having to manually deal with all the clunkyRc
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