Enum rhai::EvalAltResult[][src]

#[non_exhaustive]
pub enum EvalAltResult {
Show variants ErrorSystem(StringBox<dyn Error>), ErrorParsing(ParseErrorTypePosition), ErrorVariableNotFound(StringPosition), ErrorFunctionNotFound(StringPosition), ErrorInFunctionCall(StringStringBox<EvalAltResult>, Position), ErrorModuleNotFound(StringPosition), ErrorInModule(StringBox<EvalAltResult>, Position), ErrorUnboundThis(Position), ErrorMismatchDataType(StringStringPosition), ErrorMismatchOutputType(StringStringPosition), ErrorArrayBounds(usizeINTPosition), ErrorStringBounds(usizeINTPosition), ErrorIndexingType(StringPosition), ErrorFor(Position), ErrorDataRace(StringPosition), ErrorAssignmentToConstant(StringPosition), ErrorDotExpr(StringPosition), ErrorArithmetic(StringPosition), ErrorTooManyOperations(Position), ErrorTooManyModules(Position), ErrorStackOverflow(Position), ErrorDataTooLarge(StringPosition), ErrorTerminated(DynamicPosition), ErrorRuntime(DynamicPosition), LoopBreak(boolPosition), Return(DynamicPosition),
}
Expand description

Evaluation result.

All wrapped Position values represent the location in the script where the error occurs.

Thread Safety

Currently, EvalAltResult is neither Send nor Sync. Turn on the sync feature to make it Send + Sync.

Variants (Non-exhaustive)

This enum is marked as 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.
ErrorSystem(StringBox<dyn Error>)

System error. Wrapped values are the error message and the internal error.

ErrorParsing(ParseErrorTypePosition)

Syntax error.

ErrorVariableNotFound(StringPosition)

Usage of an unknown variable. Wrapped value is the variable name.

ErrorFunctionNotFound(StringPosition)

Call to an unknown function. Wrapped value is the function signature.

ErrorInFunctionCall(StringStringBox<EvalAltResult>, Position)

An error has occurred inside a called function. Wrapped values are the function name, function source, and the interior error.

ErrorModuleNotFound(StringPosition)

Usage of an unknown module. Wrapped value is the module name.

ErrorInModule(StringBox<EvalAltResult>, Position)

An error has occurred while loading a module. Wrapped value are the module name and the interior error.

ErrorUnboundThis(Position)

Access to this that is not bound.

ErrorMismatchDataType(StringStringPosition)

Data is not of the required type. Wrapped values are the type requested and type of the actual result.

ErrorMismatchOutputType(StringStringPosition)

Returned type is not the same as the required output type. Wrapped values are the type requested and type of the actual result.

ErrorArrayBounds(usizeINTPosition)

Array access out-of-bounds. Wrapped values are the current number of elements in the array and the index number.

ErrorStringBounds(usizeINTPosition)

String indexing out-of-bounds. Wrapped values are the current number of characters in the string and the index number.

ErrorIndexingType(StringPosition)

Trying to index into a type that is not an array, an object map, or a string, and has no indexer function defined. Wrapped value is the type name.

ErrorFor(Position)

The for statement encounters a type that is not an iterator.

ErrorDataRace(StringPosition)

Data race detected when accessing a variable. Wrapped value is the variable name.

ErrorAssignmentToConstant(StringPosition)

Assignment to a constant variable. Wrapped value is the variable name.

ErrorDotExpr(StringPosition)

Inappropriate property access. Wrapped value is the property name.

ErrorArithmetic(StringPosition)

Arithmetic error encountered. Wrapped value is the error message.

ErrorTooManyOperations(Position)

Number of operations over maximum limit.

ErrorTooManyModules(Position)

Modules over maximum limit.

ErrorStackOverflow(Position)

Call stack over maximum limit.

ErrorDataTooLarge(StringPosition)

Data value over maximum size limit. Wrapped value is the type name.

ErrorTerminated(DynamicPosition)

The script is prematurely terminated. Wrapped value is the termination token.

ErrorRuntime(DynamicPosition)

Run-time error encountered. Wrapped value is the error token.

LoopBreak(boolPosition)

Breaking out of loops - not an error if within a loop. The wrapped value, if true, means breaking clean out of the loop (i.e. a break statement). The wrapped value, if false, means breaking the current context (i.e. a continue statement).

Return(DynamicPosition)

Not an error: Value returned from a script via the return keyword. Wrapped value is the result value.

Implementations

impl EvalAltResult[src]

pub fn is_pseudo_error(&self) -> bool[src]

Is this a pseudo error? A pseudo error is one that does not occur naturally.

LoopBreak and Return are pseudo errors.

pub fn is_catchable(&self) -> bool[src]

Can this error be caught?

Panics

Panics when LoopBreak or Return.

pub fn is_system_exception(&self) -> bool[src]

Is this error a system exception?

Panics

Panics when LoopBreak or Return.

pub fn position(&self) -> Position[src]

Get the position of this error.

pub fn take_position(&mut self) -> Position[src]

Remove the position information from this error and return it.

The position of this error is set to NONE afterwards.

pub fn set_position(&mut self, new_position: Position)[src]

Override the position of this error.

Trait Implementations

impl Debug for EvalAltResult[src]

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

Formats the value using the given formatter. Read more

impl Display for EvalAltResult[src]

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

Formats the value using the given formatter. Read more

impl Error for EvalAltResult[src]

fn source(&self) -> Option<&(dyn Error + 'static)>1.30.0[src]

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

fn backtrace(&self) -> Option<&Backtrace>[src]

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

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

fn description(&self) -> &str1.0.0[src]

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

fn cause(&self) -> Option<&dyn Error>1.0.0[src]

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

impl From<ParseError> for EvalAltResult[src]

fn from(err: ParseError) -> Self[src]

Performs the conversion.

impl From<ParseErrorType> for EvalAltResult[src]

fn from(err: ParseErrorType) -> Self[src]

Performs the conversion.

impl<T: AsRef<str>> From<T> for EvalAltResult[src]

fn from(err: T) -> Self[src]

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

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

Converts the given value to a String. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.