pub struct PassPointerAndWrite<T, const N: usize>(/* private fields */);
Expand description
Pass a pointer into the host and write to it after the host call ends.
This casts a given type into &mut [u8]
using AsMut<[u8]>
and passes a pointer to
that byte slice into the host. The host doesn’t read from this and instead creates
a default instance of type T
and passes it as a &mut T
into the host function
implementation. After the host function finishes this value is then cast into a &[u8]
using
AsRef<[u8]>
and written back into the guest memory.
Raw FFI type: u32
(a pointer)
Trait Implementations§
Source§impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndWrite<&'a mut T, N>
impl<'a, T, const N: usize> FromFFIValue<'a> for PassPointerAndWrite<&'a mut T, N>
Source§fn 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.Source§fn 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.Source§fn 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. Read moreAuto Trait Implementations§
impl<T, const N: usize> Freeze for PassPointerAndWrite<T, N>
impl<T, const N: usize> RefUnwindSafe for PassPointerAndWrite<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for PassPointerAndWrite<T, N>where
T: Send,
impl<T, const N: usize> Sync for PassPointerAndWrite<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for PassPointerAndWrite<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for PassPointerAndWrite<T, N>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more