referrerpolicy=no-referrer-when-downgrade
sp_runtime_interface::host

Trait FromFFIValue

Source
pub trait FromFFIValue: RIType {
    type SelfInstance;

    // Required method
    fn from_ffi_value(
        context: &mut dyn FunctionContext,
        arg: Self::FFIType,
    ) -> Result<Self::SelfInstance>;
}
Expand description

Something that can be created from a ffi value. Implementations are safe to assume that the arg given to from_ffi_value is only generated by the corresponding wasm::IntoFFIValue implementation.

Required Associated Types§

Source

type SelfInstance

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.

Required Methods§

Source

fn from_ffi_value( context: &mut dyn FunctionContext, arg: Self::FFIType, ) -> Result<Self::SelfInstance>

Create SelfInstance from the given

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromFFIValue for bool

Source§

type SelfInstance = bool

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: u32) -> Result<bool>

Source§

impl FromFFIValue for i8

Source§

type SelfInstance = i8

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: i32) -> Result<i8>

Source§

impl FromFFIValue for i16

Source§

type SelfInstance = i16

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: i32) -> Result<i16>

Source§

impl FromFFIValue for i32

Source§

type SelfInstance = i32

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: i32) -> Result<i32>

Source§

impl FromFFIValue for i64

Source§

type SelfInstance = i64

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: i64) -> Result<i64>

Source§

impl FromFFIValue for i128

Source§

type SelfInstance = i128

Source§

fn from_ffi_value(context: &mut dyn FunctionContext, arg: u32) -> Result<i128>

Source§

impl FromFFIValue for str

Source§

type SelfInstance = String

Source§

fn from_ffi_value(context: &mut dyn FunctionContext, arg: u64) -> Result<String>

Source§

impl FromFFIValue for u8

Source§

type SelfInstance = u8

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: u32) -> Result<u8>

Source§

impl FromFFIValue for u16

Source§

type SelfInstance = u16

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: u32) -> Result<u16>

Source§

impl FromFFIValue for u32

Source§

type SelfInstance = u32

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: u32) -> Result<u32>

Source§

impl FromFFIValue for u64

Source§

type SelfInstance = u64

Source§

fn from_ffi_value(_: &mut dyn FunctionContext, arg: u64) -> Result<u64>

Source§

impl FromFFIValue for u128

Source§

type SelfInstance = u128

Source§

fn from_ffi_value(context: &mut dyn FunctionContext, arg: u32) -> Result<u128>

Source§

impl<T: 'static + Decode> FromFFIValue for [T]

Source§

type SelfInstance = Vec<T>

Source§

fn from_ffi_value(context: &mut dyn FunctionContext, arg: u64) -> Result<Vec<T>>

Source§

impl<T: 'static + Decode> FromFFIValue for Vec<T>

Source§

type SelfInstance = Vec<T>

Source§

fn from_ffi_value(context: &mut dyn FunctionContext, arg: u64) -> Result<Vec<T>>

Source§

impl<const N: usize> FromFFIValue for [u8; N]

Source§

type SelfInstance = [u8; N]

Source§

fn from_ffi_value( context: &mut dyn FunctionContext, arg: u32, ) -> Result<[u8; N]>

Implementors§

Source§

impl<T: PassBy> FromFFIValue for T

Source§

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

Source§

type SelfInstance = Pointer<T>