RustQ.Rustler.Term (rustq v0.9.4)

Copy Markdown View Source

Generates Rustler Term<'a> builders, decoders, and map access helpers.

Most helpers are authored with defrust or RustQ AST. The remaining EscapeExpr fragments are localized Rustler wrapper-boundary escapes for unsafe raw term construction or caller-supplied decoder expressions.

Summary

Functions

bool_val(arg1, arg2)

@spec bool_val(term(), RustQ.Type.path({:rustler, :Atom})) :: boolean()

builders(opts \\ [])

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

decoder(name, opts)

@spec decoder(
  atom() | String.t(),
  keyword()
) :: [RustQ.Rust.Fragment.t()]

default_struct_values(arg1, arg2, arg3)

@spec default_struct_values(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:_)),
  RustQ.Type.path(:Atom),
  RustQ.Type.usize()
) :: RustQ.Type.vec(RustQ.Type.path({:rustler, :wrapper, :NIF_TERM}))

encoder(name, opts)

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

f64_val(arg1, arg2)

@spec f64_val(term(), RustQ.Type.path({:rustler, :Atom})) :: RustQ.Type.f64()

get(arg1, arg2)

@spec get(term(), RustQ.Type.path({:rustler, :Atom})) :: RustQ.Type.option(term())

get_bool(arg1, arg2)

@spec get_bool(term(), RustQ.Type.path({:rustler, :Atom})) ::
  RustQ.Type.option(boolean())

get_i64(arg1, arg2)

@spec get_i64(term(), RustQ.Type.path({:rustler, :Atom})) ::
  RustQ.Type.option(RustQ.Type.i64())

get_map(arg1, arg2)

@spec get_map(term(), RustQ.Type.path({:rustler, :Atom})) :: RustQ.Type.option(term())

get_string(arg1, arg2)

@spec get_string(term(), RustQ.Type.path({:rustler, :Atom})) ::
  RustQ.Type.option(String.t())

get_string_list(arg1, arg2)

@spec get_string_list(term(), RustQ.Type.path({:rustler, :Atom})) ::
  RustQ.Type.option(RustQ.Type.vec(String.t()))

get_term_list(arg1, arg2)

@spec get_term_list(term(), RustQ.Type.path({:rustler, :Atom})) ::
  RustQ.Type.option(RustQ.Type.vec(term()))

helpers(opts \\ [])

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

is_nil(arg1)

@spec is_nil(term()) :: boolean()

list_val(arg1, arg2)

@spec list_val(term(), RustQ.Type.path({:rustler, :Atom})) :: RustQ.Type.vec(term())

make_map_from_terms(arg1, arg2)

@spec make_map_from_terms(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.slice({term(), term()})
) :: RustQ.Type.nif_result(term())

make_struct_from_terms(arg1, arg2, arg3)

@spec make_struct_from_terms(
  RustQ.Type.path(:Env, RustQ.Type.lifetime(:a)),
  RustQ.Type.slice(term()),
  RustQ.Type.slice(term())
) :: RustQ.Type.nif_result(term())

opt(arg1, arg2)

@spec opt(term(), RustQ.Type.path({:rustler, :Atom})) :: RustQ.Type.option(term())

str_val(arg1, arg2)

@spec str_val(term(), RustQ.Type.path({:rustler, :Atom})) :: String.t()

type_atom(arg1)

@spec type_atom(term()) :: RustQ.Type.option(RustQ.Type.path({:rustler, :Atom}))

type_eq(arg1, arg2)

@spec type_eq(term(), RustQ.Type.path({:rustler, :Atom})) :: boolean()

type_str(arg1)

@spec type_str(term()) :: String.t()