RustQ.Rustler.Resource (rustq v0.11.1)

Copy Markdown View Source

Generates Rustler resource structs, handles, decoders, and initialization helpers.

Summary

Functions

Builds the ResourceArc<name> type.

Builds a decoder for ResourceArc<name>.

Builds a decoder for an Elixir-facing resource handle.

Builds resource items plus a decoder for an Elixir-facing handle.

Builds the resource registration macro invocation.

Builds the resource struct and its rustler::Resource implementation.

Builds a type alias for ResourceArc<name>.

Functions

arc_type(name)

@spec arc_type(atom() | String.t()) :: RustQ.Rust.AST.TypePath.t()

Builds the ResourceArc<name> type.

decoder(name, opts \\ [])

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

Builds a decoder for ResourceArc<name>.

handle_decoder(name, opts \\ [])

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

Builds a decoder for an Elixir-facing resource handle.

handle_items(name, opts \\ [])

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

Builds resource items plus a decoder for an Elixir-facing handle.

init(name)

Builds the resource registration macro invocation.

items(name, opts \\ [])

Builds the resource struct and its rustler::Resource implementation.

type_alias(name, opts \\ [])

@spec type_alias(
  atom() | String.t(),
  keyword()
) :: RustQ.Rust.AST.TypeAlias.t()

Builds a type alias for ResourceArc<name>.