pub struct SourcePosition { /* private fields */ }Expand description
The transparent carrier’s payload: a binder’s kind, or where a subterm came from.
A position in a source text, in Lean’s convention: the LINE is 1-based and the COLUMN is
0-based and counted in Unicode scalar values. Held in its canonical spelling, the one Lean
prints a diagnostic’s position in — file:line:column — so a position IS its text: two
positions are equal exactly when they print the same, and reading one back needs no rendering.
Implementations§
Source§impl SourcePosition
impl SourcePosition
Sourcepub fn new(file: impl Into<String>, line: u32, column: u32) -> SourcePosition
pub fn new(file: impl Into<String>, line: u32, column: u32) -> SourcePosition
The position file:line:column.
Sourcepub fn parse(text: &str) -> Option<SourcePosition>
pub fn parse(text: &str) -> Option<SourcePosition>
Read a position in its canonical spelling, file:line:column. The LAST two :-separated
fields are the line and the column, so a file name may itself contain :; the file is not
empty, the line is at least 1, and both numbers are written in canonical decimal (no sign,
no leading zero) so that reading and printing are inverse.
Trait Implementations§
Source§impl Clone for SourcePosition
impl Clone for SourcePosition
Source§fn clone(&self) -> SourcePosition
fn clone(&self) -> SourcePosition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more