pub struct SourceLocation {
pub offset: usize,
pub line: usize,
pub column: usize,
}
Fields§
§offset: usize
Byte offset into the file (counted from zero).
line: usize
Line number (counted from zero).
column: usize
Column number (counted from zero)
Implementations§
Source§impl SourceLocation
impl SourceLocation
Sourcepub fn new(offset: usize, line_starts: &[usize]) -> SourceLocation
pub fn new(offset: usize, line_starts: &[usize]) -> SourceLocation
Construct a new source location.
The line_starts
indicates the byte offsets where new lines
start in the file. The first element should thus be 0
since
every file has at least one line starting at offset 0
.
Trait Implementations§
Source§impl Clone for SourceLocation
impl Clone for SourceLocation
Source§fn clone(&self) -> SourceLocation
fn clone(&self) -> SourceLocation
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SourceLocation
impl Debug for SourceLocation
Source§impl Default for SourceLocation
impl Default for SourceLocation
Source§fn default() -> SourceLocation
fn default() -> SourceLocation
Returns the “default value” for a type. Read more
Source§impl Ord for SourceLocation
impl Ord for SourceLocation
Source§fn cmp(&self, other: &SourceLocation) -> Ordering
fn cmp(&self, other: &SourceLocation) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SourceLocation
impl PartialEq for SourceLocation
Source§impl PartialOrd for SourceLocation
impl PartialOrd for SourceLocation
Source§impl Serialize for SourceLocation
impl Serialize for SourceLocation
impl Copy for SourceLocation
impl Eq for SourceLocation
impl StructuralPartialEq for SourceLocation
Auto Trait Implementations§
impl Freeze for SourceLocation
impl RefUnwindSafe for SourceLocation
impl Send for SourceLocation
impl Sync for SourceLocation
impl Unpin for SourceLocation
impl UnwindSafe for SourceLocation
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