Expand description
Text output: where rendered fragments go.
A renderer produces many small fragments (a quote, a field, a comma) and
must never hold a whole document. TextOut is the boundary: a
fragment in, a failure out. WriteOut coalesces fragments to a byte
budget before they reach an io::Write, so a renderer can write a
character at a time without paying a system call for each, and it is
where the output limit and the output-bytes metric live, because it is
the one stage that knows what actually left. Join and
ReplaceText are the two text combinators whose correctness depends
on the difference between a logical item and a transport chunk, which is
why they live beside the writer rather than in the language that uses
them.
Structs§
- Concat
- Concatenation: a
Joinwith no separator, under the name the design brief and the language give it. - Join
- Writes a separator between logical items.
- Replace
Text - Replaces every occurrence of a fixed literal, across fragment boundaries.
- String
Out - A
TextOutthat keeps the text, for tests and small results. - Write
Out - Coalesces fragments and writes them to an
io::Write.
Constants§
- DEFAULT_
BUDGET - The default coalescing budget of a
WriteOut: large enough that a write per budget is negligible next to the parse, small enough to be invisible in a process’s memory.
Traits§
- TextOut
- The fragment boundary every renderer writes to, which is one of alchemy’s shared types. A consumer of text fragments.