pub struct CodeMap { /* private fields */ }
Expand description
A data structure recording source code files for position lookup.
Implementations§
source§impl CodeMap
impl CodeMap
sourcepub fn add_file(&mut self, name: String, source: String) -> Arc<File>
pub fn add_file(&mut self, name: String, source: String) -> Arc<File>
Adds a file with the given name and contents.
Use the returned File
and its .span
property to create Spans
representing substrings of the file.
sourcepub fn find_file(&self, pos: Pos) -> &Arc<File>
pub fn find_file(&self, pos: Pos) -> &Arc<File>
Looks up the File
that contains the specified position.
sourcepub fn look_up_pos(&self, pos: Pos) -> Loc
pub fn look_up_pos(&self, pos: Pos) -> Loc
Gets the file, line, and column represented by a Pos
.
sourcepub fn look_up_span(&self, span: Span) -> SpanLoc
pub fn look_up_span(&self, span: Span) -> SpanLoc
Gets the file and its line and column ranges represented by a Span
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeMap
impl RefUnwindSafe for CodeMap
impl Send for CodeMap
impl Sync for CodeMap
impl Unpin for CodeMap
impl UnwindSafe for CodeMap
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