pub struct WasmMemoryRegion { /* private fields */ }Expand description
Pre-allocated WASM memory region
Implementations§
Source§impl WasmMemoryRegion
impl WasmMemoryRegion
Sourcepub fn alloc(&mut self, size: usize, align: usize) -> Option<usize>
pub fn alloc(&mut self, size: usize, align: usize) -> Option<usize>
Allocate bytes from region, returns the offset
Returns the starting offset of the allocated region.
Use get_slice to access the allocated memory safely.
Sourcepub fn get_slice(&self, offset: usize, len: usize) -> Option<&[u8]>
pub fn get_slice(&self, offset: usize, len: usize) -> Option<&[u8]>
Get a slice at the given offset
Auto Trait Implementations§
impl Freeze for WasmMemoryRegion
impl RefUnwindSafe for WasmMemoryRegion
impl Send for WasmMemoryRegion
impl Sync for WasmMemoryRegion
impl Unpin for WasmMemoryRegion
impl UnwindSafe for WasmMemoryRegion
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more