pub type Pointer<T> = Pointer<T>;
Expand description
A pointer that can be used in a runtime interface function signature.
Aliased Type§
struct Pointer<T> { /* private fields */ }
Implementations
§impl<T> Pointer<T>where
T: PointerType,
impl<T> Pointer<T>where
T: PointerType,
pub fn offset(self, offset: u32) -> Option<Pointer<T>>
pub fn offset(self, offset: u32) -> Option<Pointer<T>>
Calculate the offset from this pointer.
offset
is in units of T
. So, 3
means 3 * mem::size_of::<T>()
as offset to the
pointer.
Returns an Option
to respect that the pointer could probably overflow.
pub fn null() -> Pointer<T>
pub fn null() -> Pointer<T>
Create a null pointer.
pub fn cast<R>(self) -> Pointer<R>where
R: PointerType,
pub fn cast<R>(self) -> Pointer<R>where
R: PointerType,
Cast this pointer of type T
to a pointer of type R
.
Trait Implementations§
Source§impl<T: PointerType> FromFFIValue for Pointer<T>
impl<T: PointerType> FromFFIValue for Pointer<T>
Source§type SelfInstance = Pointer<T>
type SelfInstance = Pointer<T>
As
Self
can be an unsized type, it needs to be represented by a sized type at the host.
This SelfInstance
is the sized type.Source§fn from_ffi_value(_: &mut dyn FunctionContext, arg: u32) -> Result<Self>
fn from_ffi_value(_: &mut dyn FunctionContext, arg: u32) -> Result<Self>
Create
SelfInstance
from the givenSource§impl<T: PointerType> IntoFFIValue for Pointer<T>
impl<T: PointerType> IntoFFIValue for Pointer<T>
Source§fn into_ffi_value(self, _: &mut dyn FunctionContext) -> Result<u32>
fn into_ffi_value(self, _: &mut dyn FunctionContext) -> Result<u32>
Convert
self
into a ffi value.§impl<T> IntoValue for Pointer<T>where
T: PointerType,
impl<T> IntoValue for Pointer<T>where
T: PointerType,
§const VALUE_TYPE: ValueType = ValueType::I32
const VALUE_TYPE: ValueType = ValueType::I32
The type of the value in wasm.
§fn into_value(self) -> Value
fn into_value(self) -> Value
Convert
self
into a wasm Value
.§impl<T> TryFromValue for Pointer<T>where
T: PointerType,
impl<T> TryFromValue for Pointer<T>where
T: PointerType,
§fn try_from_value(val: Value) -> Option<Pointer<T>>
fn try_from_value(val: Value) -> Option<Pointer<T>>
Try to convert the given
Value
into Self
.