Skip to main content

Module Patch

Module Patch 

Source

Structs§

Patch
A single byte-range replacement in the original source text.
SpanCollector
Collect all Spans of a plain-identifier Expr::Path matching Target within an expression tree.

Functions§

ApplyPatches
Apply a sorted list of non-overlapping patches to Source.
LineColToByte
Convert a 1-based (line, col) pair to a byte offset in Source. col is 0-based character offset within the line (proc_macro2 convention).
SpanBytes
Extract a byte range from a proc_macro2 Span relative to Source.
StmtLineRange
Given a Stmt::Local, return the byte range of the entire statement line in Source, including the trailing newline if present.
StmtSpan 🔒