RustQ.Rustler.Nif (rustq v0.9.9)

Copy Markdown View Source

Generates Rustler NIF exports, NifStruct declarations, and raw NIF_TERM builders.

Most helpers in this module use RustQ AST. The raw NIF_TERM builders are an explicit low-level Rustler escape boundary for unsafe wrapper APIs; prefer RustQ.Rustler.Term helpers when normal Term<'a> values are available.

Summary

Types

spec()

@type spec() :: {atom() | String.t(), keyword()}

Functions

export(name, opts)

@spec export(
  atom() | String.t(),
  keyword()
) :: RustQ.Rust.Function.t()

exports(specs)

@spec exports([spec()]) :: [RustQ.Rust.Function.t()]

exports_from_source(path, specs, defaults \\ [])

@spec exports_from_source(Path.t(), [spec()], keyword()) :: [RustQ.Rust.Function.t()]

struct(name, module, opts \\ [])

@spec struct(atom() | String.t(), module() | String.t(), keyword()) ::
  RustQ.Rust.Fragment.t()

stubs_from_functions(functions, module)

@spec stubs_from_functions(
  [RustQ.Syn.Function.t() | RustQ.Rust.AST.Function.t() | {term(), term()}],
  module()
) :: String.t()

stubs_from_source(path, specs, module, defaults \\ [])

@spec stubs_from_source(Path.t(), [spec()], module(), keyword()) :: String.t()

term_builders(opts \\ [])

@spec term_builders(keyword()) :: [RustQ.Rust.Fragment.t()]