Bumps [rustler](https://github.com/rusterlium/rustler) from 0.22.2 to 0.23.0. - [Release notes](https://github.com/rusterlium/rustler/releases) - [Changelog](https://github.com/rusterlium/rustler/blob/master/CHANGELOG.md) - [Commits](https://github.com/rusterlium/rustler/compare/rustler-0.22.2...rustler-0.23.0) --- updated-dependencies: - dependency-name: rustler dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
Nif for Elixir.Xler.Native
To build the NIF module:
- Make sure your projects
mix.exshas the:rustlercompiler listed in theprojectfunction:compilers: [:rustler] ++ Mix.compilers()If there already is a:compilerslist, you should append:rustlerto it. - Add your crate to the
rustler_cratesattribute in the `project function. See here. - Your NIF will now build along with your project.
To load the NIF:
defmodule Xler.Native do
use Rustler, otp_app: <otp-app>, crate: "xler_native"
# When your NIF is loaded, it will override this function.
def add(_a, _b), do: :erlang.nif_error(:nif_not_loaded)
end
Examples
This is a complete example of a NIF written in Rust.