Skip to main content

Module emit

Module emit 

Source
Expand description

Emitting the crate::ir as formatted Rust source.

Items are built as a proc_macro2::TokenStream with quote!, parsed into a syn::File (which guarantees the output is syntactically valid Rust), and pretty-printed with prettyplease.

Structs§

PreludeTypeName
A Rust prelude type that the emitted file names without a path, and what needs it.
ReservedTypeName
A fixed type name the generator emits at the crate root for a given target, which a component-schema model must not collide with.
Targets
Which generator interfaces to emit alongside the shared per-operation types.

Constants§

HEADER
Header prepended to every generated file: the do-not-edit marker, then a blanket clippy allowance.

Traits§

ClientEmitter
Emits a client for a lowered Service as top-level token items.
ServerEmitter
Emits a server interface for a lowered Service as top-level token items.

Functions§

emit_flat
Render a module as a flat file: the shared component models and per-operation types at the crate root, followed by the requested generator interfaces.
emit_module
Render a module of IR items into formatted Rust source.
prelude_type_names
The prelude types the requested targets name without a path.
reserved_type_names
The crate-root type names the requested targets emit. A component schema whose generated name matches one of these will produce a duplicate item, so crate::lower::check_type_name_collisions rejects it up front.