pub trait WasmAccessDynCompatible: WasmAccessDynCompatibleRaw {
// Required methods
fn memcpy_with<T>(&self, offset: *mut T, data: &[T]);
fn memcpy_to_with<T>(&self, offset: &mut [T], src: *const T);
fn store_le_with<T>(&self, offset: *mut T, value: T);
fn load_le_with<T: Debug + Copy>(&self, offset: *const T) -> T;
fn memory_director_with<T>(&self, ptr: *const T) -> Option<*const T>;
fn memory_director_mut_with<T>(&self, ptr: *mut T) -> Option<*mut T>;
fn _main_with(&self) -> Errno;
fn _reset_with(&self);
fn _start_with(&self);
// Provided methods
fn as_array_with<T: Debug + Copy>(
&self,
ptr: *const T,
len: usize,
) -> WasmArrayAccessDynCompatible<'_, '_, T, Self> { ... }
fn get_array_with<T: Debug + Copy>(
&self,
ptr: *const T,
len: usize,
) -> Box<[T]> { ... }
}Expand description
A dynamically compatible trait providing high-level memory operations in WASM.
Required Methods§
Sourcefn memcpy_with<T>(&self, offset: *mut T, data: &[T])
fn memcpy_with<T>(&self, offset: *mut T, data: &[T])
Copies a slice of data into WASM memory starting at the given offset.
Sourcefn memcpy_to_with<T>(&self, offset: &mut [T], src: *const T)
fn memcpy_to_with<T>(&self, offset: &mut [T], src: *const T)
Copies data from the source pointer into the provided mutable slice of WASM memory.
Sourcefn store_le_with<T>(&self, offset: *mut T, value: T)
fn store_le_with<T>(&self, offset: *mut T, value: T)
Stores a value in WASM memory at the given offset using little-endian encoding.
Sourcefn load_le_with<T: Debug + Copy>(&self, offset: *const T) -> T
fn load_le_with<T: Debug + Copy>(&self, offset: *const T) -> T
Loads a value from WASM memory at the given offset using little-endian encoding.
Sourcefn memory_director_with<T>(&self, ptr: *const T) -> Option<*const T>
fn memory_director_with<T>(&self, ptr: *const T) -> Option<*const T>
Directs a pointer to its mapped address in a single-memory model.
Sourcefn memory_director_mut_with<T>(&self, ptr: *mut T) -> Option<*mut T>
fn memory_director_mut_with<T>(&self, ptr: *mut T) -> Option<*mut T>
Directs a mutable pointer to its mapped address in a single-memory model.
Sourcefn _main_with(&self) -> Errno
fn _main_with(&self) -> Errno
Execute the _main entrypoint of the WASM module.
Sourcefn _reset_with(&self)
fn _reset_with(&self)
Resets the memory state of the WASM module.
Sourcefn _start_with(&self)
fn _start_with(&self)
Executes the _start initialization entrypoint.
Provided Methods§
Sourcefn as_array_with<T: Debug + Copy>(
&self,
ptr: *const T,
len: usize,
) -> WasmArrayAccessDynCompatible<'_, '_, T, Self>
fn as_array_with<T: Debug + Copy>( &self, ptr: *const T, len: usize, ) -> WasmArrayAccessDynCompatible<'_, '_, T, Self>
Helper method to create a WasmArrayAccessDynCompatible for the given pointer and length.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.