Struct wasmedge_sdk::Memory
source · pub struct Memory { /* private fields */ }
Expand description
Defines a linear memory.
Implementations§
source§impl Memory
impl Memory
sourcepub fn new(ty: MemoryType) -> WasmEdgeResult<Self>
pub fn new(ty: MemoryType) -> WasmEdgeResult<Self>
Creates a new wasm memory instance with the given type.
Argument
ty
- The type of the memory instance to be created.
Error
- If fail to create the memory instance, then WasmEdgeError::Mem(MemError::Create) is returned.
sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Returns the exported name of this memory.
Notice that this field is meaningful only if this memory is used as an exported instance.
sourcepub fn mod_name(&self) -> Option<&str>
pub fn mod_name(&self) -> Option<&str>
Returns the name of the module instance from which this memory exports.
Notice that this field is meaningful only if this memory is used as an exported instance.
sourcepub fn ty(&self) -> &MemoryType
pub fn ty(&self) -> &MemoryType
Returns a reference to the type of this memory.
sourcepub fn page(&self) -> u32
pub fn page(&self) -> u32
Returns the size, in WebAssembly pages (64 KiB of each page), of this wasm memory.
sourcepub fn size(&self) -> u64
pub fn size(&self) -> u64
Returns the byte length of this memory. The returned value will be a multiple of the wasm page size, 64k.