Effect

Enum Effect 

Source
pub enum Effect {
    AssertionFailed,
    DivisionByZero,
    IntegerOverflow,
    InvalidAddress,
    InvalidReference,
    InvalidStackIndex,
    OutOfOperators,
    StackUnderflow,
    UnknownIdentifier,
    Yield,
}
Expand description

§An event triggered by scripts, to signal a specific condition

Evaluating an operator can trigger an effect. Active effects are stored in in Eval’s effect field. Please refer to the documentation of that field, for more information on effects and how to handle them.

Variants§

§

AssertionFailed

§An assertion failed

Can trigger when evaluating assert, if its input is zero.

§

DivisionByZero

§Tried to divide by zero

Can trigger when evaluating the / operator, if its second input is 0.

§

IntegerOverflow

§Division resulted in integer overflow

Can only trigger when evaluating the / operator, if its first input is the lowest signed (two’s complement) 32-bit integer, and its second input is -1.

All other arithmetic operators wrap on overflow and don’t trigger this effect.

§

InvalidAddress

§A memory address is out of bounds

Can trigger when evaluating the read or write operators, if their address input (when interpreted as an unsigned 32-bit integer) does not refer to an address that is within the bounds of the memory.

§

InvalidReference

§Evaluated a reference that is not paired with a matching label

Can trigger when evaluating a reference, if that reference does not refer to a label.

§

InvalidStackIndex

§An index that supposedly refers to a value on the stack, doesn’t

Can trigger when evaluating the copy or drop operators, if their index input is too large to refer to a value on the stack.

§

OutOfOperators

§Ran out of operators to evaluate

Triggers when evaluation reaches the end of the script, where no more operators are available. This signals the regular end of the evaluation.

§

StackUnderflow

§Tried popping a value from an empty stack

Can trigger when evaluating any operator that has more inputs than the number of values currently on the stack.

§

UnknownIdentifier

§Evaluated an identifier that the language does not recognize

Can trigger when evaluating an identifier, if that identifier does not refer to a known operation.

§

Yield

§The evaluating script yields control to the host

Triggers when evaluating the yield operator.

Trait Implementations§

Source§

impl Debug for Effect

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<StackUnderflow> for Effect

Source§

fn from(StackUnderflow: StackUnderflow) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Effect

Source§

fn eq(&self, other: &Effect) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Effect

Source§

impl StructuralPartialEq for Effect

Auto Trait Implementations§

§

impl Freeze for Effect

§

impl RefUnwindSafe for Effect

§

impl Send for Effect

§

impl Sync for Effect

§

impl Unpin for Effect

§

impl UnwindSafe for Effect

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

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

Performs the conversion.