View Source Kinda.CodeGen.NIFDecl (kinda v0.11.0)

A generated NIF declaration.

Describes a NIF's wrapper and NIF names, parameters (as an arity or a list of names), C types, typespecs and dirty scheduler flag, and round-trips to and from the JSON-compatible manifest format. from_resource_kind/1 expands the standard NIF functions a resource kind is expected to provide.

Summary

Types

dirty()

@type dirty() :: :dirty_io | :dirty_cpu | false

name()

@type name() :: nil | String.t() | atom()

t()

@type t() :: %Kinda.CodeGen.NIFDecl{
  arity: term(),
  dirty: dirty(),
  doc: String.t() | nil,
  nif_name: name(),
  param_ctypes: [Kinda.Wrapper.CType.t() | nil] | nil,
  param_typespecs: [Kinda.CodeGen.TypeSpecRef.t()] | nil,
  params: [String.t() | atom()] | integer(),
  return_ctype: Kinda.Wrapper.CType.t() | nil,
  return_typespec: Kinda.CodeGen.TypeSpecRef.t() | nil,
  wrapper_name: name()
}

Functions

from_manifest(manifest)

@spec from_manifest(map()) :: t()

from_resource_kind(kind_decl)

to_manifest(nif_decl)

@spec to_manifest(t()) :: map()