pub struct Coords {
pub absolute: usize,
pub line: usize,
pub column: usize,
}
Expand description
A Coords represents a single location within the parser input
Fields§
§absolute: usize
The absolute character position
line: usize
The row position
column: usize
The column position
Implementations§
Source§impl Coords
Associated functions for the Coords struct
impl Coords
Associated functions for the Coords struct
Sourcepub fn from_coords(value: &Coords) -> Self
pub fn from_coords(value: &Coords) -> Self
Create a new coordinate based on a coordinate reference
Sourcepub fn is_before(&self, other: &Coords) -> bool
pub fn is_before(&self, other: &Coords) -> bool
Check whether this coordinate is strictly before another coordinate
Sourcepub fn is_after(&self, other: &Coords) -> bool
pub fn is_after(&self, other: &Coords) -> bool
Check whether this coordinate is strictly after another coordinate
Sourcepub fn copy_from(&mut self, other: &Coords)
pub fn copy_from(&mut self, other: &Coords)
Take all the values of the supplied Coords instance
Sourcepub fn increment_newline(&mut self)
pub fn increment_newline(&mut self)
In place increment with a line return
Sourcepub fn copy_increment(&self) -> Self
pub fn copy_increment(&self) -> Self
Increment the coordinate within the current line and return new struct
Sourcepub fn copy_increment_newline(&self) -> Self
pub fn copy_increment_newline(&self) -> Self
Increment the coordinates and bump the line number (assumes that the new line will start in column zero) and return new struct
Sourcepub fn copy_decrement(&mut self) -> Self
pub fn copy_decrement(&mut self) -> Self
Decrement the coordinate within the current line, but panic if we try and decrement column or absolute below zero, return a new struct