uniffi-rs
uniffi-rs copied to clipboard
Call a function at every ffi point
trafficstars
I'd love that we could setup an optional hook fn every time we enter (and exit?) an uniffi call. This would allow for things such as:
Automatic tracing spanning (https://github.com/mozilla/uniffi-rs/issues/2210).
Custom behaviour on call. I don't have any specific thing in mind but I'm sure that this can be very useful.
And perhaps more importantly, the ability to use thread locals. Right now it's impossible because the caller could call us from any thread that they spawn, without the thread locals being setup.
This is important for things such as string interners, the ability to call tokio::spawn freely or anything that requires an init fn per thread.