Enum rustler::error::Error

source ·
pub enum Error {
    BadArg,
    Atom(&'static str),
    RaiseAtom(&'static str),
    RaiseTerm(Box<dyn Encoder>),
    Term(Box<dyn Encoder>),
}
Expand description

Represents usual errors that can happen in a nif. This enables you to return an error from anywhere, even places where you don’t have an Env available.

Variants§

§

BadArg

Returned when the NIF has been called with the wrong number or type of arguments.

§

Atom(&'static str)

Encodes the string into an atom and returns it from the NIF.

§

RaiseAtom(&'static str)

§

RaiseTerm(Box<dyn Encoder>)

§

Term(Box<dyn Encoder>)

Encodes an arbitrary Boxed Encoder and returns {:error, term} from the NIF. Very useful for returning descriptive, context-full errors.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.