pub enum VmError {
StackUnderflow,
TypeMismatch {
expected: &'static str,
got: &'static str,
},
UnboundVariable(String),
DivisionByZero,
InvalidInstruction(usize),
ProgramEmpty,
}Expand description
Errors that can occur during VM execution.
Variants§
StackUnderflow
A pop or peek was attempted on an empty stack.
TypeMismatch
An operation received a value of an unexpected type.
Fields
UnboundVariable(String)
A LoadVar instruction referenced a name not present in the environment.
DivisionByZero
A Div instruction was attempted with a zero denominator.
InvalidInstruction(usize)
The instruction pointer jumped outside the program bounds.
ProgramEmpty
execute was called with a program that contains no instructions.
Trait Implementations§
Source§impl Error for VmError
impl Error for VmError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for VmError
impl RefUnwindSafe for VmError
impl Send for VmError
impl Sync for VmError
impl Unpin for VmError
impl UnsafeUnpin for VmError
impl UnwindSafe for VmError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more