pub trait FromFFIValue<'a>: RIType {
type Owned;
// Required methods
fn from_ffi_value(
context: &mut dyn FunctionContext,
arg: Self::FFIType,
) -> Result<Self::Owned>;
fn take_from_owned(owned: &'a mut Self::Owned) -> Self::Inner;
// Provided method
fn write_back_into_runtime(
_value: Self::Owned,
_context: &mut dyn FunctionContext,
_arg: Self::FFIType,
) -> Result<()> { ... }
}Expand description
A type used as a parameter in a host function. Can be created from an 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§
Required Methods§
Sourcefn from_ffi_value(
context: &mut dyn FunctionContext,
arg: Self::FFIType,
) -> Result<Self::Owned>
fn from_ffi_value( context: &mut dyn FunctionContext, arg: Self::FFIType, ) -> Result<Self::Owned>
Creates Self::Owned from the given arg received through the FFI boundary from the
runtime.
Sourcefn take_from_owned(owned: &'a mut Self::Owned) -> Self::Inner
fn take_from_owned(owned: &'a mut Self::Owned) -> Self::Inner
Creates Self::Inner from an owned value.
Provided Methods§
Sourcefn write_back_into_runtime(
_value: Self::Owned,
_context: &mut dyn FunctionContext,
_arg: Self::FFIType,
) -> Result<()>
fn write_back_into_runtime( _value: Self::Owned, _context: &mut dyn FunctionContext, _arg: Self::FFIType, ) -> Result<()>
Write back a modified value back into the runtime’s memory.
Only makes sense for parameters like e.g. &mut [u8].
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a> FromFFIValue<'a> for bool
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for bool
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for i8
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for i8
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for i16
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for i16
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for i32
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for i32
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for i64
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for i64
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for u8
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for u8
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for u16
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for u16
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for u32
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for u32
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for u64
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for u64
Available on non-
substrate_runtime only.Implementors§
Source§impl<'a, T, U> FromFFIValue<'a> for PassAs<T, U>
Available on non-substrate_runtime only.
impl<'a, T, U> FromFFIValue<'a> for PassAs<T, U>
Available on non-
substrate_runtime only.Source§impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndRead<&'a T, N>
Available on non-substrate_runtime only.
impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndRead<&'a T, N>
Available on non-
substrate_runtime only.Source§impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndReadCopy<T, N>
Available on non-substrate_runtime only.
impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndReadCopy<T, N>
Available on non-
substrate_runtime only.Source§impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndWrite<&'a mut T, N>
Available on non-substrate_runtime only.
impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndWrite<&'a mut T, N>
Available on non-
substrate_runtime only.Source§impl<'a, T: Decode> FromFFIValue<'a> for PassFatPointerAndDecode<T>
Available on non-substrate_runtime only.
impl<'a, T: Decode> FromFFIValue<'a> for PassFatPointerAndDecode<T>
Available on non-
substrate_runtime only.Source§impl<'a, T: Decode> FromFFIValue<'a> for PassFatPointerAndDecodeSlice<&'a [T]>
Available on non-substrate_runtime only.
impl<'a, T: Decode> FromFFIValue<'a> for PassFatPointerAndDecodeSlice<&'a [T]>
Available on non-
substrate_runtime only.Source§impl<'a, T: PointerType> FromFFIValue<'a> for Pointer<T>
Available on non-substrate_runtime only.
impl<'a, T: PointerType> FromFFIValue<'a> for Pointer<T>
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for PassFatPointerAndRead<&'a [u8]>
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for PassFatPointerAndRead<&'a [u8]>
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for PassFatPointerAndRead<&'a str>
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for PassFatPointerAndRead<&'a str>
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for PassFatPointerAndRead<Vec<u8>>
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for PassFatPointerAndRead<Vec<u8>>
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for PassFatPointerAndReadOption<&'a [u8]>
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for PassFatPointerAndReadOption<&'a [u8]>
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for PassFatPointerAndReadWrite<&'a mut [u8]>
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for PassFatPointerAndReadWrite<&'a mut [u8]>
Available on non-
substrate_runtime only.Source§impl<'a> FromFFIValue<'a> for PassFatPointerAndWrite<&'a mut [u8]>
Available on non-substrate_runtime only.
impl<'a> FromFFIValue<'a> for PassFatPointerAndWrite<&'a mut [u8]>
Available on non-
substrate_runtime only.