Function Macro

DexDEFINE_CLOSURE_TYPE

unstable since: 1.2

Declaration [src]

#define DEX_DEFINE_CLOSURE_TYPE (
  type_name,
  type_prefix,
  ...
)

Description [src]

This macro is a lightweight helper for quickly defining closure-like state structs with matching type_prefix_new() and type_prefix_free() helpers.

It is intentionally generic; while coroutine task states are a common use case, the generated type is also useful for quick one-off task/closure structs.

Example:

DEX_DEFINE_CLOSURE_TYPE (MyTaskState, my_task_state,
                         DEX_DEFINE_CLOSURE_VALUE (gsize, bytes),
                         DEX_DEFINE_CLOSURE_POINTER (GBytes *, bytes_obj, g_bytes_unref),
                         DEX_DEFINE_CLOSURE_OBJECT (GSocketConnection, conn))

Available since: 1.2

This function is not directly available to language bindings.

Parameters

type_name

Type: -

Generated struct name.

type_prefix

Type: -

Function prefix for generated helpers.

...

Type: -

One or more DEX_DEFINE_CLOSURE_*() field descriptors.