pub fn render_from_ast(
source: &str,
module: &Module,
trivia: &[Trivia],
) -> Result<String, AstSpanError>Expand description
Reconstruct source from the AST’s byte spans plus the lexer’s trivia.
The AST-level mirror of lexer::render_lossless: it checks the spans nest
(V2), then tiles the file from every content node span merged with the
non-blank trivia spans (V1/V3). Ok(reconstruction) is byte-identical to
source; Err names the first nesting violation or the first run of bytes
no span covers (content the AST dropped).
Obtain trivia from crate::lexer::lex_with_trivia.
§Errors
Returns AstSpanError when spans fail nesting checks or when bytes in
source are not covered by any AST node or trivia span.