pub struct Loc {
pub file: FileId,
pub line: u32,
pub column: u32,
}Expand description
A position resolved back to a human coordinate.
Lines and columns both count from one, because that is what every editor, every other compiler and every user expects, and an off by one here is the kind of bug that survives for years because nobody quite trusts their own arithmetic enough to file it.
Fields§
§file: FileIdWhich file.
line: u32The line, counting from one.
column: u32The column in bytes, counting from one.
Bytes rather than characters or display columns. A tab counts as one and a multibyte
character counts as its encoded length, which is what a caret line drawn from the same
bytes needs. -ftabstop and the width of a CJK character are the renderer’s problem;
what belongs here is the offset into the line.
Trait Implementations§
impl Copy for Loc
impl Eq for Loc
impl StructuralPartialEq for Loc
Auto Trait Implementations§
impl Freeze for Loc
impl RefUnwindSafe for Loc
impl Send for Loc
impl Sync for Loc
impl Unpin for Loc
impl UnsafeUnpin for Loc
impl UnwindSafe for Loc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more