Skip to main content

render_lossless

Function render_lossless 

Source
pub fn render_lossless(
    source: &str,
    tokens: &[Token],
    trivia: &[Trivia],
) -> Result<String, String>
Expand description

Reconstruct the source from token and trivia spans.

Ok only when the spans tile the file — every non-whitespace byte inside exactly one token or comment span — in which case the result is byte-identical to source. This is the lossless-trivia oracle for the formatter.