[][src]Enum passerine::common::opcode::Opcode

#[repr(u8)]pub enum Opcode {
    Con,
    Save,
    Load,
    Call,
    Return,
    Clear,
}

This enum represents a single opcode. Under the hood, it's just a byte. This allows non opcode bytes to be inserted in bytecode streams. | Opcode | operands, top first | byte-streams | Does | | ------ | ------------------- | ------------ | ---------------------------------------------- | | Con | | Const Index | Pushes value from constant table onto stack | | Save | Data | | Stores Data in Symbol | | Load | | Local Index | Replaces symbol on top of stack with its value | | Clear | | | Clears stack to last frame/local | | Call | Fun, Data | | Calls the function passing Data as arg | | Return | Data | | Clears the frame, leaving value on the stack |

Variants

Con
Save
Load
Call
Return
Clear

Implementations

impl Opcode[src]

pub fn from_byte(byte: u8) -> Opcode[src]

Convert a raw byte to an opcode. Note that non-opcode bytes should never be interpreted as an opcode. Under the hood, this is just a transmute, so the regular cautions apply. This should never cause a crash and if it does, the vm's designed to crash hard so it'll be pretty obvious.

Trait Implementations

impl Debug for Opcode[src]

Auto Trait Implementations

impl RefUnwindSafe for Opcode

impl Send for Opcode

impl Sync for Opcode

impl Unpin for Opcode

impl UnwindSafe for Opcode

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.