Re:Write Elixir NIFs in Rust
by kamma4434 on Sunday August 06, 2023 @05:28AM
(#37020317)
Pet peeve of mine: whenever that’s possible, avoid writing libraries in one language that references something that has to be compiled in a different language. If you do, do you end up with Perl/CPAN - installing anything becomes a pain. It’s nice to have a quicker XML parser, but it would be real nice if it was a plug-in and there was a slower, but easy install version that required no external things to be compiled.
[ Parent
| on HN ]
Unless one can do like in Java,.NET and nodejs, package the libraries alongside the bindings, for all major target platforms.
You can with Rustler using rustler precompiled. You write a workflow in GitHub that builds for all the supported targets and the precompiled library will download the correct one when a user downloads your library.
Re:Write Elixir NIFs in Rust
by peoplefromibiza on Sunday August 06, 2023 @07:19AM
(#37020842)
not anymore, Elixir community as usual delivers some great tool for their beloved developers and users
https://dashbit.co/blog/rustler-precompiled
(it's similar to pre-compiled Python wheels, but it's better developers' side in my opinion)
It's not a pain because of
https://github.com/philss/rustler_precompiled
The users of your library doesn't have to install anything. The library will seem like any Elixir library when they use it.
It safe because when you upload your project to Hex.pm you include a file with all the checksum of the latest version of your library and when you install the library it will use those to download the library from GitHub.