Comment by lukax
Do not write the bindings manually. Just use the amazing uniffi-rs library from Mozilla.
https://github.com/mozilla/uniffi-rs
You can generate bindings for multiple languages. It supports error handling on both sides and latest versions also support native async integration.
I've used it to reuse the same Rust engine in iOS and Android apps and write native UI.
The bindings are inefficient doing excessive cloning. But if performance is not a concern then its fine.