Provides compile-time configuration for a NIF module.
When used, Rustler expects the
:otp_app as option.
:otp_app should point to the OTP application that
the dynamic library can be loaded from. For example:
defmodule MyNIF do use Rustler, otp_app: :my_nif end
This allows the module to be configured like so:
config :my_nif, MyNIF, crate: :my_nif, load_data: [1, 2, 3]
:crate- the name of the Rust crate (as an atom), if different from your
otp_appvalue. If you have more than one crate in your project, you will need to be explicit about which crate you intend to use.
:load_data- Any valid term. This value is passed into the NIF when it is loaded (default:
Either of the above options can be passed directly into the
use macro like so:
defmodule MyNIF do use Rustler, otp_app: :my_nif, crate: :some_other_crate, load_data: :something end