wasmtime_component_resource_any_t typedef

wasmtime_component_resource_any_t = wasmtime_component_resource_any

\brief Represents a component resource which can be either guest-owned or host-owned.

This type is an opaque type used to represent any component model resource. Internally this tracks information about ownership, type, etc. Values of this type have dynamic ownership guarantees associated with them. Notably from a component-model perspective values of this type must either be converted to a host resource with wasmtime_component_resource_any_to_host or dropped via wasmtime_component_resource_any_drop. This is required to handle various metadata tracking appropriately, and if this is not done then the resource will be leaked into the store and a trap may be raised.

Note that this type also has dynamic memory allocations associated with it and users must call wasmtime_component_resource_any_delete to deallocate the host-side resources. This destructor can be called in an RAII fashion and will only clean up memory, not metadata related to the resource. It is required to call wasmtime_component_resource_any_delete to prevent leaking memory on the host. It's highly recommended to call wasmtime_component_resource_any_drop to avoid leaking memory in a long-lived store, but if this is forgotten then deallocating the store will deallocate all memory still.

Implementation

typedef wasmtime_component_resource_any_t = wasmtime_component_resource_any;