referrerpolicy=no-referrer-when-downgrade
sp_runtime_interface

Type Alias 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

§

impl<T> Pointer<T>
where T: PointerType,

pub fn new(ptr: u32) -> Pointer<T>

Create a new instance of Self.

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>

Create a null pointer.

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>

Source§

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>

Create SelfInstance from the given
Source§

impl<T: PointerType> IntoFFIValue for Pointer<T>

Source§

fn into_ffi_value(self, _: &mut dyn FunctionContext) -> Result<u32>

Convert self into a ffi value.
Source§

impl<T: PointerType> RIType for Pointer<T>

Source§

type FFIType = u32

The ffi type that is used to represent Self.
§

impl<T> Clone for Pointer<T>
where T: Clone + PointerType,

§

fn clone(&self) -> Pointer<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for Pointer<T>
where T: Debug + PointerType,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> From<u32> for Pointer<T>
where T: PointerType,

§

fn from(ptr: u32) -> Pointer<T>

Converts to this type from the input type.
§

impl<T> IntoValue for Pointer<T>
where T: PointerType,

§

const VALUE_TYPE: ValueType = ValueType::I32

The type of the value in wasm.
§

fn into_value(self) -> Value

Convert self into a wasm Value.
§

impl<T> PartialEq for Pointer<T>
where T: PartialEq + PointerType,

§

fn eq(&self, other: &Pointer<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> TryFromValue for Pointer<T>
where T: PointerType,

§

fn try_from_value(val: Value) -> Option<Pointer<T>>

Try to convert the given Value into Self.
§

impl<T> Copy for Pointer<T>
where T: Copy + PointerType,

§

impl<T> Eq for Pointer<T>
where T: Eq + PointerType,

§

impl<T> StructuralPartialEq for Pointer<T>
where T: PointerType,