Zig.Parser.Nif (zigler v0.9.1) View Source
This datastructure represents structured information about a single nif
inside of a Zig.sigil_Z/2
block. This is used to generate the
exported_nifs
variable which is an array of ErlNifFunc
structs. The
following keys are implemented:
- name: (
atom/0
) the function name to be bound into the module - arity: (
arity/0
) the arity of the erlang function (the zig function may have a different arity). - doc: (
iodata/0
) zig docstrings which should be turned into elixir docs - args: (
String.t/0
) a list of zig types which are the arguments for the function - retval: (
String.t/0
) the type of the return value - opts: (
t:keyword
) list of nif options. These options are currently supported:concurrency: <model>
picks a long-running nif concurrency model. The following concurrency models are supported:- :threaded -- if the nif should run in a separate OS thread.
- :yielding -- if the nif should use zig's
yield
keyword to yield to the BEAM scheduler. - :dirty_cpu -- if the nif should run in a dirty cpu scheduler.
- :dirty_io -- if the nif should run in a dirty io scheduler.
Link to this section Summary
Link to this section Types
Specs
concurrency() :: :threaded | :yielding | :dirty_io | :dirty_cpu
Specs
option() :: {:concurrency, concurrency()}
Specs
Link to this section Functions
Specs
validate_args([String.t()], Parser.t(), non_neg_integer()) :: :ok | no_return()
Specs
validate_arity([String.t()], Parser.t(), non_neg_integer()) :: :ok | no_return()
Specs
validate_retval([String.t()], Parser.t(), non_neg_integer()) :: :ok | no_return()