pub struct SourceInfo { /* private fields */ }
Expand description
A SourceInfo
maintains location data for parsed objects.
Maintains the filename (if from a file) or the originating string (if from a string).
Helps with the conversion from byte-position in the source to a LineCol
.
Implementations§
Source§impl SourceInfo
impl SourceInfo
pub fn unknown() -> SourceInfo
pub fn source(&self) -> &Source
pub fn from_file(filepath: &Path, contents: &str) -> SourceInfo
pub fn from_string(contents: &str) -> SourceInfo
pub fn start(&self, item: &dyn HasLoc) -> LineCol
pub fn end(&self, item: &dyn HasLoc) -> LineCol
pub fn linecol_from(&self, pos: usize) -> LineCol
Trait Implementations§
Source§impl Clone for SourceInfo
impl Clone for SourceInfo
Source§fn clone(&self) -> SourceInfo
fn clone(&self) -> SourceInfo
Returns a copy 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 SourceInfo
impl RefUnwindSafe for SourceInfo
impl Send for SourceInfo
impl Sync for SourceInfo
impl Unpin for SourceInfo
impl UnwindSafe for SourceInfo
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