Trait wasmer_types::MemorySize
source · pub unsafe trait MemorySize: Copy {
type Offset: Default + Debug + Display + Eq + Ord + PartialEq<Self::Offset> + PartialOrd<Self::Offset> + Clone + Copy + ValueType + Into<u64> + From<u32> + From<u16> + From<u8> + TryFrom<u64> + TryFrom<u32> + TryFrom<u16> + TryFrom<u8> + TryInto<usize> + TryInto<u64> + TryInto<u32> + TryInto<u16> + TryInto<u8> + TryFrom<usize> + Add<Self::Offset> + Sum<Self::Offset> + AddAssign<Self::Offset>;
type Native: NativeWasmType;
const ZERO: Self::Offset;
const ONE: Self::Offset;
fn offset_to_native(offset: Self::Offset) -> Self::Native;
fn native_to_offset(native: Self::Native) -> Self::Offset;
}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§
sourcetype Offset: Default + Debug + Display + Eq + Ord + PartialEq<Self::Offset> + PartialOrd<Self::Offset> + Clone + Copy + ValueType + Into<u64> + From<u32> + From<u16> + From<u8> + TryFrom<u64> + TryFrom<u32> + TryFrom<u16> + TryFrom<u8> + TryInto<usize> + TryInto<u64> + TryInto<u32> + TryInto<u16> + TryInto<u8> + TryFrom<usize> + Add<Self::Offset> + Sum<Self::Offset> + AddAssign<Self::Offset>
type Offset: Default + Debug + Display + Eq + Ord + PartialEq<Self::Offset> + PartialOrd<Self::Offset> + Clone + Copy + ValueType + Into<u64> + From<u32> + From<u16> + From<u8> + TryFrom<u64> + TryFrom<u32> + TryFrom<u16> + TryFrom<u8> + TryInto<usize> + TryInto<u64> + TryInto<u32> + TryInto<u16> + TryInto<u8> + TryFrom<usize> + Add<Self::Offset> + Sum<Self::Offset> + AddAssign<Self::Offset>
Type used to represent an offset into a memory. This is u32 or u64.
sourcetype Native: NativeWasmType
type Native: NativeWasmType
Type used to pass this value as an argument or return value for a Wasm function.
Required Associated Constants§
Required Methods§
sourcefn offset_to_native(offset: Self::Offset) -> Self::Native
fn offset_to_native(offset: Self::Offset) -> Self::Native
Convert an Offset to a Native.
sourcefn native_to_offset(native: Self::Native) -> Self::Offset
fn native_to_offset(native: Self::Native) -> Self::Offset
Convert a Native to an Offset.