pub struct AllocateAndReturnFatPointer<T>(/* 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: u64
(a fat pointer; upper 32 bits is the size, lower 32 bits is the pointer)
Trait Implementations§
Source§impl<T> IntoFFIValue for AllocateAndReturnFatPointer<T>
impl<T> IntoFFIValue for AllocateAndReturnFatPointer<T>
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> Freeze for AllocateAndReturnFatPointer<T>
impl<T> RefUnwindSafe for AllocateAndReturnFatPointer<T>where
T: RefUnwindSafe,
impl<T> Send for AllocateAndReturnFatPointer<T>where
T: Send,
impl<T> Sync for AllocateAndReturnFatPointer<T>where
T: Sync,
impl<T> Unpin for AllocateAndReturnFatPointer<T>where
T: Unpin,
impl<T> UnwindSafe for AllocateAndReturnFatPointer<T>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