wasmtime_component_val_new function

  1. @Native<Pointer<wasmtime_component_val_t> Function(Pointer<wasmtime_component_val_t> val)>(ffi.Pointer<wasmtime_component_val_t>)>()
Pointer<wasmtime_component_val_t> wasmtime_component_val_new(
  1. Pointer<wasmtime_component_val_t> val
)

\brief Allocates a new wasmtime_component_val_t on the heap, initializing it with the contents of val.

This function is intended to be used with the variant, result, and option fields of wasmtime_component_valunion_t. The returned pointer must be deallocated with wasmtime_component_val_free to deallocate the heap-owned pointer. The val provided is "taken" meaning that its contents are transferred to the returned pointer. This is not a clone operation but instead is an operation used to move val onto a Wasmtime-defined heap allocation.

Note that wasmtime_component_val_delete should not be used for deallocating the return value because that will deallocate the contents of the value but not the value pointer itself.

Implementation

@ffi.Native<
  ffi.Pointer<wasmtime_component_val_t> Function(
    ffi.Pointer<wasmtime_component_val_t>,
  )
>()
external ffi.Pointer<wasmtime_component_val_t> wasmtime_component_val_new(
  ffi.Pointer<wasmtime_component_val_t> val,
);