Trait wasmer_wasix::syscalls::MemorySize

pub(crate) unsafe trait MemorySize: Copy {
    type Offset: Default + Debug + Display + Eq + Ord + PartialEq + PartialOrd + Clone + Copy + Sync + Send + ValueType + Into<u64> + From<u32> + From<u16> + From<u8> + TryFrom<u64> + TryFrom<u32> + TryFrom<u16> + TryFrom<u8> + TryFrom<i32> + TryInto<usize> + TryInto<u64> + TryInto<u32> + TryInto<u16> + TryInto<u8> + TryInto<i32> + TryFrom<usize> + Add + Sum + AddAssign + SubAssign + 'static;
    type Native: NativeWasmType;

    const ZERO: Self::Offset;
    const ONE: Self::Offset;

    // Required methods
    fn offset_to_native(offset: Self::Offset) -> Self::Native;
    fn native_to_offset(native: Self::Native) -> Self::Offset;
    fn is_64bit() -> bool;
}
Expand description

Trait for the Memory32 and Memory64 marker types.

This allows code to be generic over 32-bit and 64-bit memories.

§Safety

Direct memory access is unsafe

Required Associated Types§

type Offset: Default + Debug + Display + Eq + Ord + PartialEq + PartialOrd + Clone + Copy + Sync + Send + ValueType + Into<u64> + From<u32> + From<u16> + From<u8> + TryFrom<u64> + TryFrom<u32> + TryFrom<u16> + TryFrom<u8> + TryFrom<i32> + TryInto<usize> + TryInto<u64> + TryInto<u32> + TryInto<u16> + TryInto<u8> + TryInto<i32> + TryFrom<usize> + Add + Sum + AddAssign + SubAssign + 'static

Type used to represent an offset into a memory. This is u32 or u64.

type Native: NativeWasmType

Type used to pass this value as an argument or return value for a Wasm function.

Required Associated Constants§

const ZERO: Self::Offset

Zero value used for WasmPtr::is_null.

const ONE: Self::Offset

One value used for counting.

Required Methods§

fn offset_to_native(offset: Self::Offset) -> Self::Native

Convert an Offset to a Native.

fn native_to_offset(native: Self::Native) -> Self::Offset

Convert a Native to an Offset.

fn is_64bit() -> bool

True if the memory is 64-bit

Object Safety§

This trait is not object safe.

Implementors§

§

impl MemorySize for Memory32

§

type Offset = u32

§

type Native = i32

§

const ZERO: <Memory32 as MemorySize>::Offset = {transmute(0x00000000): <wasmer::Memory32 as wasmer::MemorySize>::Offset}

§

const ONE: <Memory32 as MemorySize>::Offset = {transmute(0x00000001): <wasmer::Memory32 as wasmer::MemorySize>::Offset}

§

impl MemorySize for Memory64

§

type Offset = u64

§

type Native = i64

§

const ZERO: <Memory64 as MemorySize>::Offset = {transmute(0x0000000000000000): <wasmer::Memory64 as wasmer::MemorySize>::Offset}

§

const ONE: <Memory64 as MemorySize>::Offset = {transmute(0x0000000000000001): <wasmer::Memory64 as wasmer::MemorySize>::Offset}