RustQ.Rustler.Atom (rustq v1.0.0-rc.19)

Copy Markdown View Source

Generates Rustler atom declarations, decoders, dispatchers, and cached atom helpers.

Decoder and dispatch helpers prefer RustQ AST. Options such as :on, :cases, and :unknown may accept explicit Rust expression strings for advanced caller escape hatches; prefer AST expressions when composing generated code.

Summary

Functions

Whether the module's Rust file appeared or went since the module compiled.

The RustQ AST of each defrust definition.

Callable metadata for the module's definitions.

The Rust items the module generates, in order.

The module's defrustmacro definitions.

The macro_rules! items defrustmacro emits.

The Rust modules the module's defrustmods map its aliases, or itself ([]), to.

The Rust source the module generates.

The RustQ AST of each declared Rust type.

The Rust items the module's types generate.

The Rust types the module's @types declare.

Builds OnceLock<Atom> declarations and cached atom accessors.

A Rust function defrust generates. It runs only as Rust; calling it from Elixir raises.

Builds a rustler::atoms! declaration, optionally wrapped in a module.

Builds a function that decodes Rustler atoms into Rust values.

Builds a function that dispatches an expression by atom value.

Functions

__mix_recompile__?()

Whether the module's Rust file appeared or went since the module compiled.

__rustq_asts__()

The RustQ AST of each defrust definition.

__rustq_callables__()

Callable metadata for the module's definitions.

__rustq_items__()

The Rust items the module generates, in order.

__rustq_macro_definitions__()

The module's defrustmacro definitions.

__rustq_macro_items__()

The macro_rules! items defrustmacro emits.

__rustq_rust_modules__()

The Rust modules the module's defrustmods map its aliases, or itself ([]), to.

__rustq_source__()

The Rust source the module generates.

__rustq_type_asts__()

The RustQ AST of each declared Rust type.

__rustq_type_items__()

The Rust items the module's types generate.

__rustq_types__()

The Rust types the module's @types declare.

cached(atoms, opts \\ [])

@spec cached(
  [atom() | String.t() | {atom() | String.t(), String.t()}],
  keyword()
) :: [RustQ.Rust.AST.item()]

Builds OnceLock<Atom> declarations and cached atom accessors.

cached_atom(arg1, arg2, arg3)

@spec cached_atom(
  RustQ.Type.path(:Env),
  RustQ.Type.ref(RustQ.Type.raw(:"OnceLock<Atom>")),
  RustQ.Type.ref(RustQ.Type.path(:str))
) :: atom()

A Rust function defrust generates. It runs only as Rust; calling it from Elixir raises.

declaration(atoms, opts \\ [])

@spec declaration(
  [atom() | String.t() | {atom() | String.t(), String.t()}],
  keyword()
) :: RustQ.Rust.AST.MacroItemCall.t() | RustQ.Rust.AST.Module.t()

Builds a rustler::atoms! declaration, optionally wrapped in a module.

decoder(name, opts)

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

Builds a function that decodes Rustler atoms into Rust values.

dispatch(name, opts)

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

Builds a function that dispatches an expression by atom value.