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 + 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<Self::Offset> + Sum<Self::Offset> + AddAssign<Self::Offset> + SubAssign<Self::Offset> + '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 Constants§
Required Associated Types§
sourcetype Offset: Default + Debug + Display + Eq + Ord + PartialEq<Self::Offset> + PartialOrd<Self::Offset> + 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<Self::Offset> + Sum<Self::Offset> + AddAssign<Self::Offset> + SubAssign<Self::Offset> + 'static
type Offset: Default + Debug + Display + Eq + Ord + PartialEq<Self::Offset> + PartialOrd<Self::Offset> + 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<Self::Offset> + Sum<Self::Offset> + AddAssign<Self::Offset> + SubAssign<Self::Offset> + 'static
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 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
.
Object Safety§
This trait is not object safe.