Enum rhai::EvalAltResult
source · [−]#[non_exhaustive]
pub enum EvalAltResult {
Show 31 variants
ErrorSystem(String, Box<dyn Error>),
ErrorParsing(ParseErrorType, Position),
ErrorVariableExists(String, Position),
ErrorForbiddenVariable(String, Position),
ErrorVariableNotFound(String, Position),
ErrorPropertyNotFound(String, Position),
ErrorFunctionNotFound(String, Position),
ErrorModuleNotFound(String, Position),
ErrorInFunctionCall(String, String, Box<Self>, Position),
ErrorInModule(String, Box<Self>, Position),
ErrorUnboundThis(Position),
ErrorMismatchDataType(String, String, Position),
ErrorMismatchOutputType(String, String, Position),
ErrorIndexingType(String, Position),
ErrorArrayBounds(usize, INT, Position),
ErrorStringBounds(usize, INT, Position),
ErrorBitFieldBounds(usize, INT, Position),
ErrorFor(Position),
ErrorDataRace(String, Position),
ErrorAssignmentToConstant(String, Position),
ErrorDotExpr(String, Position),
ErrorArithmetic(String, Position),
ErrorTooManyOperations(Position),
ErrorTooManyModules(Position),
ErrorStackOverflow(Position),
ErrorDataTooLarge(String, Position),
ErrorTerminated(Dynamic, Position),
ErrorCustomSyntax(String, Vec<String>, Position),
ErrorRuntime(Dynamic, Position),
LoopBreak(bool, Position),
Return(Dynamic, Position),
}
Expand description
Evaluation result.
All wrapped Position
values represent the location in the script where the error occurs.
Some errors never appear when certain features are turned on. They still exist so that the application can turn features on and off without going through massive code changes to remove/add back enum variants in match statements.
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
ErrorSystem(String, Box<dyn Error>)
System error. Wrapped values are the error message and the internal error.
ErrorParsing(ParseErrorType, Position)
Syntax error.
ErrorVariableExists(String, Position)
Shadowing of an existing variable disallowed. Wrapped value is the variable name.
ErrorForbiddenVariable(String, Position)
Forbidden variable name. Wrapped value is the variable name.
ErrorVariableNotFound(String, Position)
Access of an unknown variable. Wrapped value is the variable name.
ErrorPropertyNotFound(String, Position)
Access of an unknown object map property. Wrapped value is the property name.
ErrorFunctionNotFound(String, Position)
Call to an unknown function. Wrapped value is the function signature.
ErrorModuleNotFound(String, Position)
ErrorInFunctionCall(String, String, Box<Self>, Position)
An error has occurred inside a called function. Wrapped values are the function name, function source, and the interior error.
ErrorInModule(String, Box<Self>, 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(String, String, Position)
Data is not of the required type. Wrapped values are the type requested and type of the actual result.
ErrorMismatchOutputType(String, String, Position)
Returned type is not the same as the required output type. Wrapped values are the type requested and type of the actual result.
ErrorIndexingType(String, Position)
Trying to index into a type that has no indexer function defined. Wrapped value is the type name.
ErrorArrayBounds(usize, INT, Position)
Array access out-of-bounds. Wrapped values are the current number of elements in the array and the index number.
ErrorStringBounds(usize, INT, Position)
String indexing out-of-bounds. Wrapped values are the current number of characters in the string and the index number.
ErrorBitFieldBounds(usize, INT, Position)
Bit-field indexing out-of-bounds. Wrapped values are the current number of bits in the bit-field and the index number.
ErrorFor(Position)
The for
statement encounters a type that is not iterable.
ErrorDataRace(String, Position)
Data race detected when accessing a variable. Wrapped value is the variable name.
ErrorAssignmentToConstant(String, Position)
Assignment to a constant variable. Wrapped value is the variable name.
ErrorDotExpr(String, Position)
Inappropriate property access. Wrapped value is the property name.
ErrorArithmetic(String, Position)
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(String, Position)
Data value over maximum size limit. Wrapped value is the type name.
ErrorTerminated(Dynamic, Position)
The script is prematurely terminated. Wrapped value is the termination token.
ErrorCustomSyntax(String, Vec<String>, Position)
Error encountered for a custom syntax. Wrapped values are the error message and custom syntax symbols stream.
Normally this should never happen, unless an AST
is compiled on one
Engine
but evaluated on another unrelated Engine
.
ErrorRuntime(Dynamic, Position)
Run-time error encountered. Wrapped value is the error token.
LoopBreak(bool, Position)
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(Dynamic, Position)
Not an error: Value returned from a script via the return
keyword.
Wrapped value is the result value.
Implementations
sourceimpl EvalAltResult
impl EvalAltResult
sourcepub const fn is_pseudo_error(&self) -> bool
pub const fn is_pseudo_error(&self) -> bool
sourcepub const fn is_catchable(&self) -> bool
pub const fn is_catchable(&self) -> bool
Can this error be caught?
sourcepub const fn is_system_exception(&self) -> bool
pub const fn is_system_exception(&self) -> bool
Is this error a system exception?
sourcepub fn unwrap_inner(&self) -> &Self
pub fn unwrap_inner(&self) -> &Self
Unwrap this error and get the very base error.
sourcepub fn clear_position(&mut self) -> &mut Self
pub fn clear_position(&mut self) -> &mut Self
sourcepub fn take_position(&mut self) -> Position
pub fn take_position(&mut self) -> Position
sourcepub fn set_position(&mut self, new_position: Position) -> &mut Self
pub fn set_position(&mut self, new_position: Position) -> &mut Self
Override the position of this error.
Trait Implementations
sourceimpl Debug for EvalAltResult
impl Debug for EvalAltResult
sourceimpl Display for EvalAltResult
impl Display for EvalAltResult
sourceimpl Error for EvalAltResult
impl Error for EvalAltResult
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl<T> From<EvalAltResult> for Result<T, Box<EvalAltResult>>
impl<T> From<EvalAltResult> for Result<T, Box<EvalAltResult>>
sourcefn from(err: EvalAltResult) -> Self
fn from(err: EvalAltResult) -> Self
Converts to this type from the input type.
sourceimpl From<ParseError> for EvalAltResult
impl From<ParseError> for EvalAltResult
sourcefn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
sourceimpl From<ParseErrorType> for EvalAltResult
impl From<ParseErrorType> for EvalAltResult
sourcefn from(err: ParseErrorType) -> Self
fn from(err: ParseErrorType) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for EvalAltResult
impl !Send for EvalAltResult
impl !Sync for EvalAltResult
impl Unpin for EvalAltResult
impl !UnwindSafe for EvalAltResult
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more