Type Alias sp_runtime_interface::Pointer
source · 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
source§impl<T> Pointer<T>where
T: PointerType,
impl<T> Pointer<T>where
T: PointerType,
sourcepub 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.
sourcepub 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>
§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.source§impl<T: PointerType> RIType for Pointer<T>
impl<T: PointerType> RIType for Pointer<T>
source§impl<T> IntoValue for Pointer<T>where
T: PointerType,
impl<T> IntoValue for Pointer<T>where
T: PointerType,
source§const VALUE_TYPE: ValueType = ValueType::I32
const VALUE_TYPE: ValueType = ValueType::I32
The type of the value in wasm.
source§fn into_value(self) -> Value
fn into_value(self) -> Value
Convert
self
into a wasm Value
.