RustQ.Meta.Type (rustq v0.6.0)

Copy Markdown View Source

Structural metadata for an Elixir typespec lowered by RustQ.

RustQ.Spec.type/2 and RustQ.Spec.aliases/1 return this struct. The :kind field is the primary semantic classification (:f64, :bool, :tuple, :struct, :enum, :type, and so on). The :ast field carries the RustQ Rust type AST used for rendering, :rust is its rendered Rust type, and :meta carries shape-specific metadata such as:

  • :elements for tuple element types
  • :fields for map/struct field types
  • :elixir_name for local aliases and enum aliases
  • :elixir_module, :elixir_type, and :elixir_args for external Elixir remote types such as Skia.Path.t()

Prefer consuming this structure directly at codegen boundaries instead of parsing rendered Rust type strings.

Summary

Functions

Returns the semantic category for a lowered RustQ type.

Returns true when a type originated from a specific Elixir remote type.

Types

category()

@type category() ::
  :number
  | :integer
  | :boolean
  | :atom
  | :string
  | :term
  | :enum
  | {:tuple, [t()]}
  | {:alias, atom()}
  | :type

t()

@type t() :: %RustQ.Meta.Type{
  ast: term(),
  kind: atom(),
  meta: map(),
  rust: String.t()
}

Functions

category(type)

@spec category(t()) :: category()

Returns the semantic category for a lowered RustQ type.

external?(type, module, type)

@spec external?(t(), module(), atom()) :: boolean()

Returns true when a type originated from a specific Elixir remote type.

parse(union, aliases)

@spec parse(Macro.t(), map()) :: t()