pub fn apply_elixir_fun<'a>(
env: Env<'a>,
pid_or_name: Term<'a>,
fun: Term<'a>,
parameters: Term<'a>,
) -> Result<ElixirFunCallResult, Error>Expand description
Will run fun with the parameters parameters
on the process indicated by pid_or_name.
‘Raises’ an ArgumentError (e.g. returns Err(Error::BadArg) on the Rust side) if fun is not a function or parameters is not a list.
Even with proper parameters, the function call itself might fail.
All various scenarios are handled by the ElixirFunCallResult type.
§Notes
- It waits for a maximum of 5000 milliseconds before returning an
Ok(TimedOut). - Be sure to register any NIF that calls this function as a ‘Dirty CPU NIF’! (by using
#[rustler::nif(schedule = "DirtyCpu")]). This is important for two reasons:- calling back into Elixir might indeed take quite some time.
- we want to prevent schedulers to wait for themselves, which might otherwise sometimes happen.