[][src]Macro rustler::init

init!() { /* proc-macro */ }

Implementation of a Native Implementated Function (NIF) macro that lets the user annotate a function that will be wrapped in higer-level NIF implementation.

This example is not tested
#[rustler::nif]
fn add(a: i64, b: i64) -> i64 {
    a + b
}

#[rustler::nif]
fn add(a: i64, b: i64) -> i64 {
    a - b
}

#[rustler::nif]
fn mul(a: i64, b: i64) -> i64 {
    a * b
}

#[rustler::nif]
fn div(a: i64, b: i64) -> i64 {
    a / b
}

rustler::init!("Elixir.Math", [add, sub, mul, div], Some(load));