Hi, when using Caller to get a reference to the data stored, I often run into lifetime problems. I will have something that refers back to the data stored in the Store and then I want to for example call a callback. The problem then is that the Caller is tied to the call to caller.data_mut() (or similar) and cannot be used to call wasm functions. Any tips on dealing with that? Except cloning the data out of course, which works.
When you say you want to call a callback is that a wasm callback or something like a host callback? It's a known issue that when you borrow the T in a Caller<'_, T> then you can't access any other data in the Store<T> as a disjoint borrow, which you should theoretically be able to do. If you want to call wasm, though, that's an intentional limitation that you can't borrow T over a wasm call.
Thanks for the info! Yeah, borrowing T over a wasm call makes sense that you can not do. It was more the former case, being able to call methods on the store while T is borrowed.
Last updated: Dec 06 2025 at 06:05 UTC