pub enum VariableInstruction {
LocalGet(LocalIndex),
LocalSet(LocalIndex),
LocalTee(LocalIndex),
GlobalGet(GlobalIndex),
GlobalSet(GlobalIndex),
}Expand description
Variable instructions are concerned with access to local or global variables. These instructions get or set the values of variables, respectively. The π ππΌπΊπ .ππΎπΎ instruction is like π ππΌπΊπ .ππΎπ but also returns its argument.
See https://webassembly.github.io/spec/core/syntax/instructions.html#variable-instructions
Β§Examples
use wasm_ast::{VariableInstruction, Instruction, ValueType};
assert_eq!(
Instruction::Variable(VariableInstruction::LocalGet(0)),
VariableInstruction::LocalGet(0).into()
);
assert_eq!(
Instruction::Variable(VariableInstruction::LocalSet(1)),
VariableInstruction::LocalSet(1).into()
);
assert_eq!(
Instruction::Variable(VariableInstruction::LocalTee(1)),
VariableInstruction::LocalTee(1).into()
);
assert_eq!(
Instruction::Variable(VariableInstruction::GlobalGet(0)),
VariableInstruction::GlobalGet(0).into()
);
assert_eq!(
Instruction::Variable(VariableInstruction::GlobalSet(1)),
VariableInstruction::GlobalSet(1).into()
);VariantsΒ§
LocalGet(LocalIndex)
local.get localidx Get the value of a local variable.
LocalSet(LocalIndex)
local.set localidx Set the value of a local variable.
LocalTee(LocalIndex)
local.tee localidx The π ππΌπΊπ .ππΎπΎ instruction is like π ππΌπΊπ .ππΎπ but also returns its argument.
GlobalGet(GlobalIndex)
global.get globalidx Get the value of a global variable.
GlobalSet(GlobalIndex)
global.set globalidx Set the value of a global variable.
Trait ImplementationsΒ§
SourceΒ§impl Clone for VariableInstruction
impl Clone for VariableInstruction
SourceΒ§fn clone(&self) -> VariableInstruction
fn clone(&self) -> VariableInstruction
Returns a duplicate of the value. Read more
1.0.0 Β· SourceΒ§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceΒ§impl Debug for VariableInstruction
impl Debug for VariableInstruction
SourceΒ§impl From<VariableInstruction> for Instruction
impl From<VariableInstruction> for Instruction
SourceΒ§fn from(instruction: VariableInstruction) -> Self
fn from(instruction: VariableInstruction) -> Self
Converts to this type from the input type.
SourceΒ§impl PartialEq for VariableInstruction
impl PartialEq for VariableInstruction
impl Copy for VariableInstruction
impl Eq for VariableInstruction
impl StructuralPartialEq for VariableInstruction
Auto Trait ImplementationsΒ§
impl Freeze for VariableInstruction
impl RefUnwindSafe for VariableInstruction
impl Send for VariableInstruction
impl Sync for VariableInstruction
impl Unpin for VariableInstruction
impl UnwindSafe for VariableInstruction
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