Enum emacs::ErrorKind[][src]

pub enum ErrorKind {
    Signal {
        symbol: TempValue,
        data: TempValue,
    },
    Throw {
        tag: TempValue,
        value: TempValue,
    },
    WrongTypeUserPtr {
        expected: &'static str,
    },
}
Expand description

Error types generic to all Rust dynamic modules.

This list is intended to grow over time and it is not recommended to exhaustively match against it.

Variants

Signal

An error signaled by Lisp code.

Fields of Signal

symbol: TempValuedata: TempValue
Throw

A non-local exit thrown by Lisp code.

Fields of Throw

tag: TempValuevalue: TempValue
WrongTypeUserPtr

An error indicating that the given value is not a user-ptr of the expected type.

Examples:

#[defun]
fn wrap(x: i64) -> Result<RefCell<i64>> {
    Ok(RefCell::new(x))
}

#[defun]
fn wrap_f(x: f64) -> Result<RefCell<f64>> {
    Ok(RefCell::new(x))
}

#[defun]
fn unwrap(r: &RefCell<i64>) -> Result<i64> {
    Ok(*r.try_borrow()?)
}
(unwrap 7)          ; *** Eval error ***  Wrong type argument: user-ptrp, 7
(unwrap (wrap 7))   ; 7
(unwrap (wrap-f 7)) ; *** Eval error ***  Wrong type user-ptr: "expected: RefCell"

Fields of WrongTypeUserPtr

expected: &'static str

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

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

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

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.