alexcrichton commented on issue #1018:
This was fixed in the recently redesigned API
alexcrichton closed issue #1018:
One thing the current
wasmtime::FuncAPI 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 ofFuncinstances and explicitly usingRcto 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...) -> Rand 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 clunkyRcallocations.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: Dec 13 2025 at 19:03 UTC