Skip to main content

Module codegen

Module codegen 

Source
Expand description

Code generation: IR → Rust source code.

The main entry point is generate, which takes a parsed IR Module and produces formatted Rust source code as a string.

Modules§

classes
ClassDecl / ClassLike InterfaceDecl → wasm_bindgen extern "C" block generation.
enums
Enum code generation: string enums and numeric enums.
functions
FunctionDecl / VariableDecl → free function and static bindings.
signatures
Signature expansion: expand TypeScript overloads (with optional/variadic/union params) into multiple concrete Rust signatures with computed names.
typemap
TypeRef → syn::Type mapping with unified position-based system.

Structs§

GenerateOptions
Options for controlling code generation output.

Functions§

generate
Generate Rust source code from a parsed IR module + global context.
generate_with_options
Generate Rust source code with explicit options.