TableInstruction

Enum TableInstruction 

Source
pub enum TableInstruction {
    Get(TableIndex),
    Set(TableIndex),
    Size(TableIndex),
    Grow(TableIndex),
    Fill(TableIndex),
    Copy(TableIndex, TableIndex),
    Init(ElementIndex, TableIndex),
    ElementDrop(ElementIndex),
}
Expand description

Instructions in this group are concerned with tables table. An additional instruction that accesses a table is the control instruction 𝖼𝖺𝗅𝗅_𝗂𝗇𝖽𝗂𝗋𝖾𝖼𝗍.

See https://webassembly.github.io/spec/core/syntax/instructions.html#table-instructions

Β§Examples

use wasm_ast::{TableInstruction, Instruction};

assert_eq!(
    Instruction::Table(TableInstruction::Get(1)),
    TableInstruction::Get(1).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::Set(1)),
    TableInstruction::Set(1).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::Size(1)),
    TableInstruction::Size(1).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::Grow(1)),
    TableInstruction::Grow(1).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::Fill(1)),
    TableInstruction::Fill(1).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::Copy(0, 1)),
    TableInstruction::Copy(0, 1).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::Init(0, 0)),
    TableInstruction::Init(0, 0).into()
);
assert_eq!(
    Instruction::Table(TableInstruction::ElementDrop(0)),
    TableInstruction::ElementDrop(0).into()
);

VariantsΒ§

Β§

Get(TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.𝗀𝖾𝗍 instruction loads an element in a table.

Β§

Set(TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.π—Œπ–Ύπ— instruction stores an element in a table.

Β§

Size(TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.π—Œπ—‚π—“π–Ύ instruction returns the current size of a table.

Β§

Grow(TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.π—€π—‹π—ˆπ— instruction grows table by a given delta and returns the previous size, or βˆ’1 if enough space cannot be allocated. It also takes an initialization value for the newly allocated entries.

Β§

Fill(TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.𝖿𝗂𝗅𝗅 instruction sets all entries in a range to a given value.

Β§

Copy(TableIndex, TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.π–Όπ—ˆπ—‰π—’ instruction copies elements from a source table region to a possibly overlapping destination region; the first index denotes the destination.

Β§

Init(ElementIndex, TableIndex)

The 𝗍𝖺𝖻𝗅𝖾.𝗂𝗇𝗂𝗍 instruction copies elements from a passive element segment into a table.

Β§

ElementDrop(ElementIndex)

The 𝖾𝗅𝖾𝗆.π–½π—‹π—ˆπ—‰ instruction prevents further use of a passive element segment. This instruction is intended to be used as an optimization hint. After an element segment is dropped its elements can no longer be retrieved, so the memory used by this segment may be freed.

Trait ImplementationsΒ§

SourceΒ§

impl Clone for TableInstruction

SourceΒ§

fn clone(&self) -> TableInstruction

Returns a duplicate of the value. Read more
1.0.0 Β· SourceΒ§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
SourceΒ§

impl Debug for TableInstruction

SourceΒ§

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

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

impl From<TableInstruction> for Instruction

SourceΒ§

fn from(instruction: TableInstruction) -> Self

Converts to this type from the input type.
SourceΒ§

impl PartialEq for TableInstruction

SourceΒ§

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

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

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 Copy for TableInstruction

SourceΒ§

impl Eq for TableInstruction

SourceΒ§

impl StructuralPartialEq for TableInstruction

Auto Trait ImplementationsΒ§

Blanket ImplementationsΒ§

SourceΒ§

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

SourceΒ§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
SourceΒ§

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

SourceΒ§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
SourceΒ§

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

SourceΒ§

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

Mutably borrows from an owned value. Read more
SourceΒ§

impl<T> CloneToUninit for T
where T: Clone,

SourceΒ§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

πŸ”¬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
SourceΒ§

impl<T> From<T> for T

SourceΒ§

fn from(t: T) -> T

Returns the argument unchanged.

SourceΒ§

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

SourceΒ§

fn into(self) -> U

Calls U::from(self).

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

SourceΒ§

impl<T> ToOwned for T
where T: Clone,

SourceΒ§

type Owned = T

The resulting type after obtaining ownership.
SourceΒ§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
SourceΒ§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
SourceΒ§

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

SourceΒ§

type Error = Infallible

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

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

Performs the conversion.
SourceΒ§

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

SourceΒ§

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

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

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

Performs the conversion.