pub struct Location {
pub source: Source,
pub offset: usize,
}
Expand description
A single location within a source file, expressed as a byte offset.
Fields§
§source: Source
§offset: usize
Implementations§
Source§impl Location
impl Location
Sourcepub fn with_line_and_column(
source: Source,
line: usize,
column: usize,
) -> Location
pub fn with_line_and_column( source: Source, line: usize, column: usize, ) -> Location
Create a new location given a human-readable line and column.
Sourcepub fn iter<'a>(self, content: &'a Rc<dyn SourceContent>) -> Box<CharIter<'a>>
pub fn iter<'a>(self, content: &'a Rc<dyn SourceContent>) -> Box<CharIter<'a>>
Obtain an iterator into the source file at this location.
Sourcepub fn human(self) -> (usize, usize, usize)
pub fn human(self) -> (usize, usize, usize)
Determine the line and column information at this location.
Returns a tuple (line, column, line_offset)
.
Sourcepub fn human_line(self) -> usize
pub fn human_line(self) -> usize
Determine the line at this location.
Sourcepub fn human_column(self) -> usize
pub fn human_column(self) -> usize
Determine the column at this location.
Sourcepub fn human_line_offset(self) -> usize
pub fn human_line_offset(self) -> usize
Determine the line offset at this location.
Trait Implementations§
Source§impl Ord for Location
impl Ord for Location
Source§impl PartialOrd for Location
impl PartialOrd for Location
impl Copy for Location
impl Eq for Location
impl StructuralPartialEq 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