pub struct MemoryArgument { /* private fields */ }Expand description
Argument to load and store instructions that contains an address offset and the expected alignment (expressed as the exponent of a power of 2).
The static address offset is added to the dynamic address operand, yielding a 33 bit effective address that is the zero-based index at which the memory is accessed.
See https://webassembly.github.io/spec/core/syntax/instructions.html#memory-instructions
§Examples
§With Offset & Alignment
use wasm_ast::MemoryArgument;
let argument = MemoryArgument::new(4, 42);
assert_eq!(argument.offset(), 42);
assert_eq!(argument.align(), 4);§With Offset Only
use wasm_ast::MemoryArgument;
let argument = MemoryArgument::new(1, 42);
assert_eq!(argument.offset(), 42);
assert_eq!(argument.align(), 1);§With Alignment Only
use wasm_ast::MemoryArgument;
let argument = MemoryArgument::default_offset(4);
assert_eq!(argument.offset(), 0);
assert_eq!(argument.align(), 4);§Default
use wasm_ast::MemoryArgument;
let argument = MemoryArgument::default_offset(1);
assert_eq!(argument.offset(), 0);
assert_eq!(argument.align(), 1);Implementations§
Source§impl MemoryArgument
impl MemoryArgument
Trait Implementations§
Source§impl Clone for MemoryArgument
impl Clone for MemoryArgument
Source§fn clone(&self) -> MemoryArgument
fn clone(&self) -> MemoryArgument
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 MemoryArgument
impl Debug for MemoryArgument
Source§impl PartialEq for MemoryArgument
impl PartialEq for MemoryArgument
impl Copy for MemoryArgument
impl Eq for MemoryArgument
impl StructuralPartialEq for MemoryArgument
Auto Trait Implementations§
impl Freeze for MemoryArgument
impl RefUnwindSafe for MemoryArgument
impl Send for MemoryArgument
impl Sync for MemoryArgument
impl Unpin for MemoryArgument
impl UnwindSafe for MemoryArgument
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