pub enum ElixirFunCallResult {
Success(StoredTerm),
ExceptionRaised(StoredTerm),
Exited(StoredTerm),
ValueThrown(StoredTerm),
TimedOut,
}Expand description
The result of calling a function on the Elixir side.
This enum exists because we want to handle all possible failure scenarios correctly.
ElixirFunCallResult implements the rustler::types::Encoder trait,
to allow you to convert the result back into a Term<'a> representation for easy debugging.
However, more useful is usually to pattern-match in Rust on the resulting values instead,
and only encode the inner StoredTerm afterwards.
Variants§
Success(StoredTerm)
The happy path: The function completed successfully. In Elixir, this looks like {:ok, value}
ExceptionRaised(StoredTerm)
An exception was raised. In Elixir, this looks like {:error, {:exception, some_exception}}
Exited(StoredTerm)
The code attempted to exit the process using a call to exit(val). In Elixir, this looks like {:error, {:exit, val}}
ValueThrown(StoredTerm)
A raw value was thrown using throw(val). In Elixir, this looks like {:error, {:thrown, val}}
TimedOut
The function took too long to complete. In Elixir, this looks like {:error, :timeout}
Trait Implementations§
Source§impl Clone for ElixirFunCallResult
impl Clone for ElixirFunCallResult
Source§fn clone(&self) -> ElixirFunCallResult
fn clone(&self) -> ElixirFunCallResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more