Struct bitsy_lang::SourceInfo
source · 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 HasSpan) -> LineCol
pub fn end(&self, item: &dyn HasSpan) -> 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 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