Expand description
Code generation building blocks.
This module provides the core primitives for generating code:
CodeBuilder- Fluent API for building indented codeCodeFragment- Intermediate representation for code piecesRenderable- Trait for types that can be converted to code fragmentsFileBuilder- Composition of imports and codeIndent- Indentation configuration
§Language-Agnostic Expression Builders
Value- Semantic values (bool, int, duration, enum variants, etc.)BuilderSpec- Declarative specification for builder/fluent API patternsBlock- Scoped expressions with let bindingsRenderer- Trait for language-specific rendering
§Declarative Type Specifications
StructSpec,EnumSpec- Type definitionsFunctionSpec- Function and method definitionsTypeRef- Language-agnostic type referencesTypeMapper- Trait for language-specific type rendering
Structs§
- Attribute
Spec - An attribute or decorator on a type or member.
- Binding
- A binding in a block (let/const/var).
- Block
- A scoped block expression with bindings.
- Builder
Spec - A declarative specification for a builder pattern.
- Code
Builder - Fluent API for building code with proper indentation.
- Enum
Spec - A declarative specification for an enum.
- Field
Spec - A field in a struct.
- File
Builder - Composable file builder that combines import collection with code generation.
- Function
Spec - A declarative specification for a function or method.
- Generic
Param - A generic type parameter.
- Match
Arm - A match arm (case in switch).
- Method
Call - A method call in a builder chain.
- Param
Spec - A function parameter.
- Render
Options - Formatting options for rendering.
- Struct
Spec - A declarative specification for a struct or class.
- Terminal
- Terminal operation for a builder chain.
- Variant
Spec - A variant in an enum.
Enums§
- Attribute
Arg - An argument to an attribute.
- Code
Fragment - Represents a fragment of generated code.
- Constructor
- How to construct the builder’s base expression.
- Indent
- Indentation style for generated code.
- Pattern
- A pattern for matching.
- Primitive
Type - Primitive types supported across languages.
- Receiver
- Method receiver type.
- Statement
- A statement in a function body.
- TypeRef
- A language-agnostic type reference.
- Value
- A semantic value that can be rendered to any language.
- Variant
Kind - Kind of enum variant.
- Visibility
- Visibility/access level for types and members.
Traits§
- Function
Renderer - Trait for rendering function specs to language-specific code.
- Renderable
- Trait for types that can be rendered to code fragments.
- Renderer
- Trait for language-specific rendering of expressions.
- Structure
Renderer - Trait for rendering structure specs to language-specific code.
- Type
Mapper - Trait for mapping types to language-specific representations.