Trait sp_runtime_interface::pass_by::PassByImpl

source ·
pub trait PassByImpl<T>: RIType {
    // Required methods
    fn into_ffi_value(
        instance: T,
        context: &mut dyn FunctionContext,
    ) -> Result<Self::FFIType>;
    fn from_ffi_value(
        context: &mut dyn FunctionContext,
        arg: Self::FFIType,
    ) -> Result<T>;
}
Expand description

Something that provides a strategy for passing a type between wasm and the host.

This trait exposes the same functionality as crate::host::IntoFFIValue and crate::host::FromFFIValue to delegate the implementation for a type to a different type.

This trait is used for the host implementation.

Required Methods§

source

fn into_ffi_value( instance: T, context: &mut dyn FunctionContext, ) -> Result<Self::FFIType>

Convert the given instance to the ffi value.

For more information see: crate::host::IntoFFIValue::into_ffi_value

source

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

Create T from the given ffi value.

For more information see: crate::host::FromFFIValue::from_ffi_value

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Codec> PassByImpl<T> for Codec<T>

source§

impl<T: Copy + Into<u8> + TryFrom<u8>> PassByImpl<T> for Enum<T>

source§

impl<T: PassByInner<Inner = I>, I> PassByImpl<T> for Inner<T, I>
where I: IntoFFIValue + FromFFIValue<SelfInstance = I> + RIType,