Expand description
The one append-only writer every L4 target uses.
Targets write text straight into a Writer. The writer owns:
- the output text, only ever appended to;
- indentation (two spaces per level, written by
Writer::newline); - the set of runtime helpers the body used, in first-use order;
- span links, through a
LinkSinkchosen at compile time. WithNoLinksevery link call compiles to nothing, so a writer that does not record costs exactly what a bare string buffer costs.
Preambles (helper imports, hoists, cache declarations) depend on what the
body used, so they are written last into their own writer and joined by
Writer::finish_with_preamble: one exact-capacity allocation and one
copy of each part. Nothing is ever insert_str-ed mid-text.
EmitDocument and SpanLink are the finished form of a recording
writer. The production compiler retains its independent document until
its fix-history gate closes (#6880).
Re-exports§
pub use document::EmitDocument;pub use document::SpanLink;
Modules§
- document
- The L4 structured emission document (Davinci P3-9).
- rewrite_
spans - Identifier spans for context-rewritten template expressions (P3-9).
- source_
map - Source Map v3 emission for generated render code.
Structs§
- Emitted
- Finished output: the text and the links over it.
- NoLinks
- The sink of a writer that does not record: every call is a no-op.
- Recorded
- The sink of a recording writer: the
SpanLinks in emission order. - Writer
- Append-only text writer with indentation, used helpers and span links.
Traits§
- Link
Sink - Where span links go. Chosen per writer at compile time.