Enum sub_script::engine::EvalAltResult
source · [−]#[non_exhaustive]
pub enum EvalAltResult {
Show 31 variants
ErrorSystem(String, Box<dyn Error + Sync + Send + 'static, Global>),
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<EvalAltResult, Global>, Position),
ErrorInModule(String, Box<EvalAltResult, Global>, Position),
ErrorUnboundThis(Position),
ErrorMismatchDataType(String, String, Position),
ErrorMismatchOutputType(String, String, Position),
ErrorIndexingType(String, Position),
ErrorArrayBounds(usize, i64, Position),
ErrorStringBounds(usize, i64, Position),
ErrorBitFieldBounds(usize, i64, 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, Global>, 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 + Sync + Send + 'static, Global>)
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<EvalAltResult, Global>, Position)
An error has occurred inside a called function. Wrapped values are the function name, function source, and the interior error.
ErrorInModule(String, Box<EvalAltResult, Global>, 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, i64, Position)
Array access out-of-bounds. Wrapped values are the current number of elements in the array and the index number.
ErrorStringBounds(usize, i64, Position)
String indexing out-of-bounds. Wrapped values are the current number of characters in the string and the index number.
ErrorBitFieldBounds(usize, i64, 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, Global>, 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) -> &EvalAltResult
pub fn unwrap_inner(&self) -> &EvalAltResult
Unwrap this error and get the very base error.
sourcepub fn clear_position(&mut self) -> &mut EvalAltResult
pub fn clear_position(&mut self) -> &mut EvalAltResult
sourcepub fn take_position(&mut self) -> Position
pub fn take_position(&mut self) -> Position
sourcepub fn set_position(&mut self, new_position: Position) -> &mut EvalAltResult
pub fn set_position(&mut self, new_position: Position) -> &mut EvalAltResult
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 Error for Box<EvalAltResult, Global>
impl Error for Box<EvalAltResult, Global>
sourcefn custom<T>(err: T) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
where
T: Display,
fn custom<T>(err: T) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
where
T: Display,
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
sourceimpl Error for Box<EvalAltResult, Global>
impl Error for Box<EvalAltResult, Global>
sourcefn custom<T>(err: T) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
where
T: Display,
fn custom<T>(err: T) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
where
T: Display,
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Raised when there is general error when deserializing a type. Read more
sourcefn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Raised when a Deserialize
receives a type different from what it was
expecting. Read more
sourcefn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Raised when a Deserialize
receives a value of the right type but that
is wrong for some other reason. Read more
sourcefn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
sourcefn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Raised when a Deserialize
enum type received a variant with an
unrecognized name. Read more
sourcefn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Raised when a Deserialize
struct type received a field with an
unrecognized name. Read more
sourcefn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Raised when a Deserialize
struct type expected to receive a required
field with a particular name but that field was not present in the
input. Read more
sourcefn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Raised when a Deserialize
struct type received more than one of the
same field. Read more
sourceimpl From<ParseError> for Box<EvalAltResult, Global>
impl From<ParseError> for Box<EvalAltResult, Global>
sourcefn from(err: ParseError) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn from(err: ParseError) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Converts to this type from the input type.
sourceimpl From<ParseError> for EvalAltResult
impl From<ParseError> for EvalAltResult
sourcefn from(err: ParseError) -> EvalAltResult
fn from(err: ParseError) -> EvalAltResult
Converts to this type from the input type.
sourceimpl From<ParseErrorType> for EvalAltResult
impl From<ParseErrorType> for EvalAltResult
sourcefn from(err: ParseErrorType) -> EvalAltResult
fn from(err: ParseErrorType) -> EvalAltResult
Converts to this type from the input type.
sourceimpl From<ParseErrorType> for Box<EvalAltResult, Global>
impl From<ParseErrorType> for Box<EvalAltResult, Global>
sourcefn from(err: ParseErrorType) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn from(err: ParseErrorType) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Converts to this type from the input type.
sourceimpl<T> From<T> for Box<EvalAltResult, Global> where
T: AsRef<str>,
impl<T> From<T> for Box<EvalAltResult, Global> where
T: AsRef<str>,
sourcefn from(err: T) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn from(err: T) -> Box<EvalAltResult, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Converts to this type from the input type.
sourceimpl<T> From<T> for EvalAltResult where
T: AsRef<str>,
impl<T> From<T> for EvalAltResult where
T: AsRef<str>,
sourcefn from(err: T) -> EvalAltResult
fn from(err: T) -> EvalAltResult
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
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcefn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more