View Source Zig.Nif.Concurrency behaviour (zigler v0.11.0)

behaviour module which describes the interface for "plugins" which generate concurrency-specific code.

Summary

Callbacks

returns "table_entry" tuples which are then used to generate the nif table. if a nif function needs multiple parts, for example, for concurrency management, then multiple entries should be returned.

Types

@type concurrency() :: :synchronous | :dirty_cpu | :dirty_io
@type table_entry() ::
  {name :: atom(), arity :: non_neg_integer(), function_pointer :: atom(),
   bootstrap :: concurrency()}

Callbacks

@callback render_elixir(Zig.Nif.t()) :: Macro.t()
@callback render_erlang(Zig.Nif.t()) :: term()
@callback render_zig(Zig.Nif.t()) :: iodata()
@callback resources(Zig.Nif.t()) :: [{:root, atom()}]
@callback table_entries(Zig.Nif.t()) :: [table_entry()]

returns "table_entry" tuples which are then used to generate the nif table. if a nif function needs multiple parts, for example, for concurrency management, then multiple entries should be returned.