Crates.io | rustler_elixir_fun |
lib.rs | rustler_elixir_fun |
version | 0.3.0 |
source | src |
created_at | 2022-05-26 14:52:47.10364 |
updated_at | 2022-05-27 12:17:48.633676 |
description | Call Elixir functions from NIFs implemented in Rust. |
homepage | |
repository | https://github.com/Qqwy/elixir-rustler_elixir_fun |
max_upload_size | |
id | 594157 |
size | 10,661 |
Ever wanted to call an Elixir function from inside some Rust code? Now you can!
This crate exposes the Rust code to interact with from your Rust code side.
See the main GitHub repo for more details.
Cargo.toml
.mix.exs
.The main function to call is apply_elixir_fun
:
let some_result : Result<Term, Error> = rustler_elixir_fun::apply_elixir_fun(env, pid_or_process_name, fun, parameters)
This function will attempt to call fun
using parameters
on the Elixir side, and block the caller until a result is available.
#[rustler::nif(schedule = "DirtyCpu")]
).
This is important for two reasons: