pub struct AllocateAndReturnPointer<T, const N: usize>(/* private fields */);
Expand description
(DEPRECATED) Return T
as a blob of bytes into the runtime.
Uses T::AsRef<[u8]>
to cast T
into a &[u8]
, allocates runtime memory
using the legacy allocator, copies the slice into the runtime memory, and
returns a pointer to it.
THIS STRATEGY IS DEPRECATED; DO NOT USE FOR NEW HOST FUNCTIONS!
Ideally use a mutable slice to return data to the guest, for example using
the PassPointerAndWrite
strategy.
Raw FFI type: u32
(a pointer to the byte blob)
Trait Implementations§
Source§impl<T, const N: usize> IntoFFIValue for AllocateAndReturnPointer<T, N>
impl<T, const N: usize> IntoFFIValue for AllocateAndReturnPointer<T, N>
Source§fn into_ffi_value(
value: Self::Inner,
context: &mut dyn FunctionContext,
) -> Result<Self::FFIType>
fn into_ffi_value( value: Self::Inner, context: &mut dyn FunctionContext, ) -> Result<Self::FFIType>
Convert
Self::Inner
into an FFI value.Auto Trait Implementations§
impl<T, const N: usize> Freeze for AllocateAndReturnPointer<T, N>
impl<T, const N: usize> RefUnwindSafe for AllocateAndReturnPointer<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for AllocateAndReturnPointer<T, N>where
T: Send,
impl<T, const N: usize> Sync for AllocateAndReturnPointer<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for AllocateAndReturnPointer<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for AllocateAndReturnPointer<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