Skip to main content

EvalError

Struct EvalError 

Source
pub struct EvalError {
    pub kind: ErrorKind,
    pub message: ErrorMessage,
    pub expr: ArenaIndex,
    pub expected: Option<&'static str>,
    pub got: Option<&'static str>,
    pub expected_args: Option<usize>,
    pub got_args: Option<usize>,
    pub backtrace: [StackFrame; 16],
    pub backtrace_len: usize,
    pub parse_error: Option<ParseError>,
}
Expand description

Evaluation error with context

Fields§

§kind: ErrorKind

What kind of error

§message: ErrorMessage

Human-readable message context

§expr: ArenaIndex

The expression that caused the error

§expected: Option<&'static str>

Expected type (for type errors)

§got: Option<&'static str>

Got type (for type errors)

§expected_args: Option<usize>

Expected argument count

§got_args: Option<usize>

Got argument count

§backtrace: [StackFrame; 16]

Call stack backtrace

§backtrace_len: usize§parse_error: Option<ParseError>

Original parse error (if applicable)

Implementations§

Source§

impl EvalError

Source

pub fn new(kind: ErrorKind) -> Self

Source

pub fn with_expr(self, expr: ArenaIndex) -> Self

Source

pub fn with_message(self, msg: &str) -> Self

Source

pub fn with_types(self, expected: &'static str, got: &'static str) -> Self

Source

pub fn with_args(self, expected: usize, got: usize) -> Self

Source

pub fn with_backtrace(self, stack: &[StackFrame], len: usize) -> Self

Source§

impl EvalError

Source

pub fn from_parse_error(e: ParseError, expr: ArenaIndex) -> Self

Create an EvalError from a ParseError with expression context

Trait Implementations§

Source§

impl Debug for EvalError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ArenaError> for EvalError

Source§

fn from(e: ArenaError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for EvalError

Source§

fn from(e: ParseError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.