# `RustQ.Meta.AST`
[🔗](https://github.com/elixir-crab/rustq/blob/v1.0.0-rc.19/lib/rustq/meta/ast.ex#L1)

Builds RustQ AST items from `defrust` metadata and explicit quoted bodies.

# `build_ast`

Lowers one `defrust` definition, with its specs, type aliases, Rust module aliases, and the
callables and macros it may use, to its RustQ AST item.

# `build_type_asts`

Builds the Rust struct, enum, and alias items the module's declared types need.

# `callables_from_specs`

```elixir
@spec callables_from_specs([term()], map()) :: [RustQ.Binding.Callable.t()]
```

Callable metadata for the module's own functions, from their specs.

# `enum_type_item!`

```elixir
@spec enum_type_item!(module(), atom() | String.t()) :: RustQ.Rust.AST.Enum.t()
```

Returns one generated Rust enum type item by name, raising on absence or kind mismatch.

# `expand_body_macros`

Expands ordinary Elixir macros in a body in `env` before it is lowered.

# `function!`

```elixir
@spec function!(module(), atom() | String.t(), keyword()) ::
  RustQ.Rust.AST.Function.t()
```

Returns one generated `defrust` function AST by name, raising when absent.

# `functions`

```elixir
@spec functions(module()) :: [RustQ.Rust.AST.Function.t()]
```

Returns all generated `defrust` function AST nodes from a compiled module.

Raises `ArgumentError` when the module does not contain compiled `defrust`
metadata.

# `functions!`

```elixir
@spec functions!(module(), [atom() | String.t()]) :: [RustQ.Rust.AST.Function.t()]
```

Returns selected generated `defrust` function AST nodes.

# `generated_type_items`

```elixir
@spec generated_type_items(module()) :: [RustQ.Rust.AST.item()]
```

Returns every generated Rust type item from a compiled RustQ module.

# `group_items`

Groups built items into their Rust modules and `impl` blocks, in definition order.

# `group_module_asts`

Groups built items as `group_items/2` does, without Rust module aliases.

# `impl!`

```elixir
@spec impl!(module(), atom() | String.t() | [atom() | String.t()], keyword()) ::
  RustQ.Rust.AST.Impl.t()
```

Returns one generated Rust implementation block for a target.

Pass `trait: Name` to select a trait implementation. Without `:trait`, only
inherent implementations match. Raises when no implementation matches or
when the selector is ambiguous.

# `impls`

```elixir
@spec impls(module()) :: [RustQ.Rust.AST.Impl.t()]
```

Returns every generated Rust implementation block from a compiled module.

# `items`

```elixir
@spec items(module()) :: [RustQ.Rust.AST.item()]
```

Returns every generated Rust item from a compiled RustQ module.

This is the public structural accessor for generated type declarations,
functions, modules, and implementation blocks.

# `macro_call!`

```elixir
@spec macro_call!(module(), atom() | String.t(), keyword()) ::
  RustQ.Rust.AST.MacroItemCall.t()
```

Builds a structural invocation of a generated Rust item macro.

`args` gives each capture its value: an atom or string for an `:ident`, a value for a
`:literal`, and RustQ AST or source for an `:expr` or `:ty`.

# `macro_item!`

```elixir
@spec macro_item!(module(), atom() | String.t()) :: RustQ.Rust.AST.MacroItem.t()
```

Returns one generated `defrustmacro` item AST by name, raising when absent.

# `macro_items!`

```elixir
@spec macro_items!(module(), [atom() | String.t()]) :: [RustQ.Rust.AST.MacroItem.t()]
```

Returns selected generated `defrustmacro` item AST nodes.

# `quoted`

```elixir
@spec quoted(
  atom(),
  keyword()
) :: RustQ.Rust.AST.Function.t()
```

Lowers one Rusty-Elixir body to a Rust function from explicit `:args`, `:returns`, and `:do`,
without a module's specs; used to build functions from generators.

# `struct_type_item!`

```elixir
@spec struct_type_item!(module(), atom() | String.t()) :: RustQ.Rust.AST.Struct.t()
```

Returns one generated Rust struct type item by name, raising on absence or kind mismatch.

# `struct_type_items`

```elixir
@spec struct_type_items(module(), [atom()], keyword()) :: [RustQ.Rust.AST.Struct.t()]
```

Builds Rust struct items for selected map-backed `@type` declarations.

Use `:derive`, `:attrs`, and `:vis` to adapt the structural type item at a
boundary such as Rustler encoding without duplicating its fields.

# `type_item!`

```elixir
@spec type_item!(module(), atom() | String.t()) :: RustQ.Rust.AST.item()
```

Returns one generated Rust type item by name, raising when absent.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
