Struct wasmedge_sys::MemType
source · pub struct MemType { /* private fields */ }
Expand description
Defines the type of a wasm memory instance
Implementations§
source§impl MemType
impl MemType
sourcepub fn create(min: u32, max: Option<u32>, shared: bool) -> WasmEdgeResult<Self>
pub fn create(min: u32, max: Option<u32>, shared: bool) -> WasmEdgeResult<Self>
Create a new MemType to be associated with the given limit range for the capacity.
Arguments
-
‘min’ - The initial size of the linear memory.
-
‘max’ - The upper bound of the linear memory size allowed to grow. If ‘max’ is set ‘None’, then the maximum size will be set
u32::MAX
. -
shared
- Whether the memory is shared or not. Reference Threading proposal for WebAssembly for details about shared memory. Ifshared
is settrue
, thenmax
MUST not beNone
.
Errors
If fail to create a MemType, then an error is returned.
Example
ⓘ
let ty = MemType::create(0, Some(u32::MAX), false);
Returns whether the memory is shared or not.
sourcepub fn as_ptr(&self) -> *const WasmEdge_MemoryTypeContext
pub fn as_ptr(&self) -> *const WasmEdge_MemoryTypeContext
Provides a raw pointer to the inner memory type context.