pub struct Origin<'a> {
pub file: Option<&'a str>,
pub line: usize,
pub col: Option<usize>,
pub fidelity: Fidelity,
}Expand description
The origin of a position in the preprocessed source: the input file, line,
and (where recoverable) column the author actually wrote, together with the
Fidelity of the mapping.
Returned by SourceMap::origin_at, SourceMap::origin_of, and
Document::origin_of.
The file is the name as written on the include file directive that
pulled it in, or None for the root document passed to Parser::parse.
line and col are 1-based. col counts Unicode scalar values from
the start of the line (matching Span::col), not grapheme clusters or
UTF-16 code units; an editor that counts grapheme clusters may report a
different column for a line containing multi-scalar graphemes. col is
Some only when fidelity is Fidelity::Verbatim: on
a line the preprocessor rewrote, the column can no longer be mapped back to
the origin, so it is reported as None.
Fields§
§file: Option<&'a str>The origin file, or None for the root document.
line: usize1-based line within file.
col: Option<usize>1-based column (Unicode scalar values) within the origin line, or None
when the preprocessor rewrote the line so the column cannot be mapped
back. See the type-level documentation.
fidelity: FidelityHow the preprocessed line relates to its origin line.