[][src]Enum arithmetic_eval::error::ErrorKind

#[non_exhaustive]pub enum ErrorKind {
    TupleLenMismatch {
        lhs: LvalueLen,
        rhs: usize,
        context: TupleLenMismatchContext,
    },
    ArgsLenMismatch {
        def: LvalueLen,
        call: usize,
    },
    CannotDestructure,
    RepeatedAssignment {
        context: RepeatedAssignmentContext,
    },
    Undefined(String),
    CannotCall,
    NativeCall(String),
    Wrapper(FromValueError),
    UnexpectedOperand {
        op: Op,
    },
    CannotCompare,
    InvalidCmpResult,
    Unsupported(UnsupportedType),
    Arithmetic(ArithmeticError),
}

Kinds of errors that can occur when compiling or interpreting expressions and statements.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
TupleLenMismatch

Mismatch between length of tuples in a binary operation or assignment.

Fields of TupleLenMismatch

lhs: LvalueLen

Length of a tuple on the left-hand side.

rhs: usize

Length of a tuple on the right-hand side.

context: TupleLenMismatchContext

Context in which the error has occurred.

ArgsLenMismatch

Mismatch between the number of arguments in the function definition and its call.

Fields of ArgsLenMismatch

def: LvalueLen

Number of args at the function definition.

call: usize

Number of args at the function call.

CannotDestructure

Cannot destructure a non-tuple variable.

RepeatedAssignment

Repeated assignment to the same variable in function args or tuple destructuring.

Fields of RepeatedAssignment

context: RepeatedAssignmentContext

Context in which the error has occurred.

Undefined(String)

Variable with the enclosed name is not defined.

CannotCall

Value is not callable (i.e., is not a function).

NativeCall(String)

Generic error during execution of a native function.

Error while converting arguments for FnWrapper.

UnexpectedOperand

Unexpected operand type for the specified operation.

Fields of UnexpectedOperand

op: Op

Operation which failed.

CannotCompare

Value cannot be compared to other values. Only numbers can be compared; other value types cannot.

InvalidCmpResult

Unexpected result of a comparison function invocation. The comparison function should always return -1, 0, or 1.

Unsupported(UnsupportedType)

Construct not supported by the interpreter.

Arithmetic(ArithmeticError)

Arithmetic error, such as division by zero.

Implementations

impl ErrorKind[src]

pub fn native(message: impl Into<String>) -> Self[src]

Creates a native error.

pub fn unsupported<T: Into<UnsupportedType>>(ty: T) -> Self[src]

Creates an error for an lvalue type not supported by the interpreter.

pub fn to_short_string(&self) -> String[src]

Returned shortened error cause.

pub fn main_span_info(&self) -> String[src]

Returns a short description of the spanned information.

pub fn help(&self) -> Option<String>[src]

Returns information helping fix the error.

Trait Implementations

impl Debug for ErrorKind[src]

impl Display for ErrorKind[src]

impl Error for ErrorKind[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,