Enum rhai::EvalAltResult[][src]

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

Evaluation result.

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

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.

ErrorParsing(ParseErrorTypePosition)

Tuple Fields

Syntax error.

ErrorReadingScriptFile(PathBufPositionError)

Tuple Fields

2: Error

Error reading from a script file. Wrapped value is the path of the script file.

Never appears under the no_std feature.

ErrorVariableNotFound(StringPosition)

Tuple Fields

0: String

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

ErrorFunctionNotFound(StringPosition)

Tuple Fields

0: String

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

ErrorInFunctionCall(StringBox<EvalAltResult>, Position)

Tuple Fields

0: String

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

ErrorModuleNotFound(StringPosition)

Tuple Fields

0: String

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

ErrorInModule(StringBox<EvalAltResult>, Position)

Tuple Fields

0: String

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

ErrorUnboundThis(Position)

Tuple Fields

Access to this that is not bound.

ErrorMismatchDataType(StringStringPosition)

Tuple Fields

0: String
1: String

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

ErrorMismatchOutputType(StringStringPosition)

Tuple Fields

0: String
1: String

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)

Tuple Fields

0: usize
1: INT

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

ErrorStringBounds(usizeINTPosition)

Tuple Fields

0: usize
1: INT

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

ErrorIndexingType(StringPosition)

Tuple Fields

0: String

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.

ErrorInExpr(Position)

Tuple Fields

Invalid arguments for in operator.

ErrorFor(Position)

Tuple Fields

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

ErrorDataRace(StringPosition)

Tuple Fields

0: String

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

ErrorAssignmentToUnknownLHS(Position)

Tuple Fields

Assignment to an inappropriate LHS (left-hand-side) expression.

ErrorAssignmentToConstant(StringPosition)

Tuple Fields

0: String

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

ErrorDotExpr(StringPosition)

Tuple Fields

0: String

Inappropriate property access. Wrapped value is the property name.

ErrorArithmetic(StringPosition)

Tuple Fields

0: String

Arithmetic error encountered. Wrapped value is the error message.

ErrorTooManyOperations(Position)

Tuple Fields

Number of operations over maximum limit.

ErrorTooManyModules(Position)

Tuple Fields

Modules over maximum limit.

ErrorStackOverflow(Position)

Tuple Fields

Call stack over maximum limit.

ErrorDataTooLarge(StringusizeusizePosition)

Tuple Fields

0: String
1: usize
2: usize

Data value over maximum size limit. Wrapped values are the type name, maximum size and current size.

ErrorTerminated(Position)

Tuple Fields

The script is prematurely terminated.

ErrorRuntime(StringPosition)

Tuple Fields

0: String

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

ErrorLoopBreak(boolPosition)

Tuple Fields

0: bool

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)

Tuple Fields

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

Implementations

Get the Position of this error.

Override the Position of this error.

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

Performs the conversion.

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.