Wasmtime
resource.h File Reference
#include <wasmtime/conf.h>
#include <wasm.h>

Go to the source code of this file.

Typedefs

typedef struct wasmtime_component_resource_type wasmtime_component_resource_type_t
 Represents the type of a component resource. More...
 

Functions

WASM_API_EXTERN wasmtime_component_resource_type_twasmtime_component_resource_type_new_host (uint32_t ty)
 Creates a new resource type representing a host-defined resource. More...
 
WASM_API_EXTERN wasmtime_component_resource_type_twasmtime_component_resource_type_clone (const wasmtime_component_resource_type_t *ty)
 Clones a resource type. More...
 
WASM_API_EXTERN bool wasmtime_component_resource_type_equal (const wasmtime_component_resource_type_t *a, const wasmtime_component_resource_type_t *b)
 Compares two resource types for equality. More...
 
WASM_API_EXTERN void wasmtime_component_resource_type_delete (wasmtime_component_resource_type_t *resource)
 Deallocates a resource type. More...
 

Typedef Documentation

◆ wasmtime_component_resource_type_t

typedef struct wasmtime_component_resource_type wasmtime_component_resource_type_t

Represents the type of a component resource.

This is an opaque structure which represents the type of a resource. This can be used to equate the type of two resources together to see if they are the same.

Function Documentation

◆ wasmtime_component_resource_type_clone()

WASM_API_EXTERN wasmtime_component_resource_type_t * wasmtime_component_resource_type_clone ( const wasmtime_component_resource_type_t ty)

Clones a resource type.

Creates a new owned copy of a resource type.

The pointer returned from this function must be deallocated with wasmtime_component_resource_type_delete.

◆ wasmtime_component_resource_type_delete()

WASM_API_EXTERN void wasmtime_component_resource_type_delete ( wasmtime_component_resource_type_t resource)

Deallocates a resource type.

This will deallocate the pointer resource any any memory that it might own.

◆ wasmtime_component_resource_type_equal()

WASM_API_EXTERN bool wasmtime_component_resource_type_equal ( const wasmtime_component_resource_type_t a,
const wasmtime_component_resource_type_t b 
)

Compares two resource types for equality.

Returns whether a and b point to logically the same resource type under the hood.

◆ wasmtime_component_resource_type_new_host()

WASM_API_EXTERN wasmtime_component_resource_type_t * wasmtime_component_resource_type_new_host ( uint32_t  ty)

Creates a new resource type representing a host-defined resource.

This function creates a new wasmtime_component_resource_type_t which represents a host-defined resource identified by the ty integer argument provided. Two host resources with different ty arguments are considered not-equal in terms of resource types. Through this the host can create distinct types of resources at runtime to ensure that components are also required to keep resources distinct.

The pointer returned from this function must be deallocated with wasmtime_component_resource_type_delete.