In Rustler you can use resource/ResourceArc to pass a reference into Elixir code. The documentation is quite lacking, but you can look at this test.
If you want to have mutable resource, you must manually synchronise on the Rust side. E.g. you can use RwLock, or an rcu.
Beware, that resource references cannot be shared across nodes AFAIK.






















