pub struct Memory { /* private fields */ }Expand description
A memory is a vector of raw uninterpreted bytes. The ๐๐๐ size in the limits of the memory type specifies the initial size of that memory, while its ๐๐บ๐, if present, restricts the size to which it can grow later. Both are in units of page size. Memories can be initialized through data segments. Memories are referenced through memory indices starting with the smallest index not referencing a memory import. Most constructs implicitly reference memory index 0.
See https://webassembly.github.io/spec/core/syntax/modules.html#memories
ยงExamples
use wasm_ast::{Memory, MemoryType, Limit};
let limit = Limit::bounded(1, 2);
let kind = MemoryType::new(limit);
let memory = Memory::new(kind);
assert_eq!(memory, kind.into());
assert_eq!(memory, limit.into());
assert_eq!(memory.kind(), &kind);Implementationsยง
Sourceยงimpl Memory
impl Memory
Sourcepub fn new(kind: MemoryType) -> Self
pub fn new(kind: MemoryType) -> Self
Creates a new Memory of the given type.
Sourcepub fn kind(&self) -> &MemoryType
pub fn kind(&self) -> &MemoryType
The type definition for this memory.
Trait Implementationsยง
impl Copy for Memory
impl Eq for Memory
impl StructuralPartialEq for Memory
Auto Trait Implementationsยง
impl Freeze for Memory
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
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