pub struct SourceLocation {
pub line: usize,
pub column: usize,
pub position: usize,
}Expand description
Location in source code with line and column
Fields§
§line: usize1-based line number.
column: usize1-based column number.
position: usize0-based byte offset in the source string.
Implementations§
Source§impl SourceLocation
impl SourceLocation
Sourcepub fn from_position(source: &str, position: usize) -> Self
pub fn from_position(source: &str, position: usize) -> Self
Convert a byte position to line/column using the source text
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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceLocation
impl RefUnwindSafe for SourceLocation
impl Send for SourceLocation
impl Sync for SourceLocation
impl Unpin for SourceLocation
impl UnsafeUnpin 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