Rustler Mix v0.10.1 Rustler

Provides compile-time configuration for a NIF module.

When used, Rustler expects the :otp_app as option. The :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]

Configuration options:

  • :crate - the name of the Rust crate (as an atom), if different from your otp_app value. 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: 0)

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

Summary

Functions

Retrieves the compile time configuration

Supported NIF API versions

Functions

compile_config(mod, opts)

Retrieves the compile time configuration.

nif_versions()

Supported NIF API versions.