Skip to main content

WasmAccessDynCompatible

Trait WasmAccessDynCompatible 

Source
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§

Source

fn memcpy_with<T>(&self, offset: *mut T, data: &[T])

Copies a slice of data into WASM memory starting at the given offset.

Source

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.

Source

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.

Source

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.

Source

fn memory_director_with<T>(&self, ptr: *const T) -> Option<*const T>

Directs a pointer to its mapped address in a single-memory model.

Source

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.

Source

fn _main_with(&self) -> Errno

Execute the _main entrypoint of the WASM module.

Source

fn _reset_with(&self)

Resets the memory state of the WASM module.

Source

fn _start_with(&self)

Executes the _start initialization entrypoint.

Provided Methods§

Source

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.

Source

fn get_array_with<T: Debug + Copy>(&self, ptr: *const T, len: usize) -> Box<[T]>

Returns a box containing the data from the WASM array.

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.

Implementors§