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
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_MemoryTypeContext
ffi
only.Provides a raw pointer to the inner memory type context.
Trait Implementations§
source§impl From<MemType> for MemoryType
impl From<MemType> for MemoryType
source§impl From<MemoryType> for MemType
impl From<MemoryType> for MemType
source§fn from(ty: MemoryType) -> Self
fn from(ty: MemoryType) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for MemType
impl Send for MemType
impl Sync for MemType
impl Unpin for MemType
impl UnwindSafe for MemType
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