pub struct CharPos {
pub line: usize,
pub column: usize,
}
Expand description
CharPos is designed to match VSCode’s vscode.Position type. Both line and column are 0-based.
A previous version of CharPos used a global character-based index,
naively thinking this was the same as VSCode’s notion of an “offset”.
However, for files using CRLF line endings, VSCode ignores the \r
when computing offsets, while Rustc does not. The unhappy compromise
is to use line-column as a common coordinate system, which is robust
to choice of line endings.
Fields§
§line: usize
§column: usize
Trait Implementations§
Source§impl Ord for CharPos
impl Ord for CharPos
Source§impl PartialOrd for CharPos
impl PartialOrd for CharPos
impl Copy for CharPos
impl Eq for CharPos
impl StructuralPartialEq for CharPos
Auto Trait Implementations§
impl Freeze for CharPos
impl RefUnwindSafe for CharPos
impl Send for CharPos
impl Sync for CharPos
impl Unpin for CharPos
impl UnwindSafe for CharPos
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