RustQ.Rust (rustq v0.11.1)

Copy Markdown View Source

Rendering boundary for structural RustQ AST and explicit Rust fragments.

Build generated Rust with RustQ.Rust.AST.Builder, ItemBuilder, PatternBuilder, and TypeBuilder. Keep those values structural until they are passed to a RustQ template or explicitly rendered here.

Use fragment/2 only for small Rust syntax escapes that RustQ cannot yet represent as AST.

Summary

Functions

Builds an explicit Rust source fragment for a known splice context.

Renders one Rust AST item, struct field, or explicit fragment.

Renders a list of Rust items separated by blank lines.

Renders a structural Rust type.

Types

Functions

fragment(kind, source)

Builds an explicit Rust source fragment for a known splice context.

render(value)

@spec render(renderable()) :: String.t()

Renders one Rust AST item, struct field, or explicit fragment.

render_all(items)

@spec render_all([RustQ.Rust.AST.item() | RustQ.Rust.Fragment.t()]) :: String.t()

Renders a list of Rust items separated by blank lines.

render_type(type)

@spec render_type(RustQ.Rust.AST.type() | atom() | String.t() | tuple() | [term()]) ::
  String.t()

Renders a structural Rust type.