Struct rustc_utils::source_map::range::CharPos
source · 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 PartialEq for CharPos
impl PartialEq for CharPos
source§impl PartialOrd for CharPos
impl PartialOrd for CharPos
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for CharPos
impl Eq for CharPos
impl StructuralEq for CharPos
impl StructuralPartialEq for CharPos
Auto Trait Implementations§
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