4 ms·
For the curious, xb95 was kind enough to tell me how they call Rust from Elixir - it's via Native Implemented Functions: http://erlang.org/doc/tutorial/nif.htm
by faitswulff 8y ago
For the curious, xb95 was kind enough to tell me how they call Rust from Elixir - it's via Native Implemented Functions:
http://erlang.org/doc/tutorial/nif.html http://erlang.org/doc/tutorial/nif.html
> As a NIF library is dynamically linked into the emulator process, this is the fastest way of calling C-code from Erlang (alongside port drivers). Calling NIFs requires no context switches. But it is also the least safe, because a crash in a NIF brings the emulator down too.
Sounds like a pretty good use for Rust!
- Buttons840 8y agoWonder if they use rustler [0], which claims it cannot crash the BEAM. Looks pretty good. [0] https://github.com/hansihe/rustler https://github.com/hansihe/rustler
- jhgg 8y agoWe do indeed. Rustler is very cool!
- qohen 8y agoSonny Scroggin of Bleacher Report gave a talk about writing NIFs in Rust (using Rustler) at last year's Code BEAM SF conference -- the video's on YouTube: https://www.youtube.com/watch?v=F86JXaCPowo https://www.youtube.com/watch?v=F86JXaCPowo