pub struct Location {
pub position: usize,
pub line: usize,
pub column: usize,
pub length: usize,
}
Expand description
Represents a location in the source code (position, line, column, length)
Fields§
§position: usize
The position in the source code (byte offset)
line: usize
The line number (1-based)
column: usize
The column number (1-based)
length: usize
The length of the token/node in characters
Implementations§
Source§impl Location
impl Location
Sourcepub fn new_simple(position: usize, line: usize, column: usize) -> Self
pub fn new_simple(position: usize, line: usize, column: usize) -> Self
Sourcepub fn end_position(&self) -> usize
pub fn end_position(&self) -> usize
Sourcepub fn end_column(&self) -> usize
pub fn end_column(&self) -> usize
Get the end column of this location (assuming single line)
§Returns
The column number at the end of this location
Trait Implementations§
impl Copy for Location
Auto Trait Implementations§
impl Freeze for Location
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
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