pub struct CodeMap<T: FileData = DefaultFileData> { /* private fields */ }Expand description
A data structure recording source code files for position lookup.
Implementations§
Source§impl<T: FileData> CodeMap<T>
impl<T: FileData> CodeMap<T>
Sourcepub fn add_file(&mut self, source: T) -> Arc<File<T>>
pub fn add_file(&mut self, source: T) -> Arc<File<T>>
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<T>>
pub fn find_file(&self, pos: Pos) -> &Arc<File<T>>
Looks up the File that contains the specified position.
Sourcepub fn look_up_pos(&self, pos: Pos) -> Loc<T>
pub fn look_up_pos(&self, pos: Pos) -> Loc<T>
Gets the file, line, and column represented by a Pos.
Sourcepub fn look_up_span(&self, span: Span) -> SpanLoc<T>
pub fn look_up_span(&self, span: Span) -> SpanLoc<T>
Gets the file and its line and column ranges represented by a Span.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for CodeMap<T>
impl<T> RefUnwindSafe for CodeMap<T>where
T: RefUnwindSafe,
impl<T> Send for CodeMap<T>
impl<T> Sync for CodeMap<T>
impl<T> Unpin for CodeMap<T>
impl<T> UnwindSafe for CodeMap<T>where
T: RefUnwindSafe,
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