pub struct SourceMap { /* private fields */ }Expand description
The source map containing all recorded sources, methods to register new ones, and methods to query about spans in relation to recorded sources.
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn load_file(&self, path: &Path) -> Result<Rc<SourceFile>>
pub fn load_file(&self, path: &Path) -> Result<Rc<SourceFile>>
Loads the given path and returns a SourceFile for it.
Sourcepub fn new_source(&self, source: &str, name: FileName) -> Rc<SourceFile>
pub fn new_source(&self, source: &str, name: FileName) -> Rc<SourceFile>
Registers source under the given file name, returning a SourceFile back.
Sourcepub fn find_source_file(&self, pos: u32) -> Option<Rc<SourceFile>>
pub fn find_source_file(&self, pos: u32) -> Option<Rc<SourceFile>>
Find the source file containing pos.
pub fn source_file_by_filename( &self, filename: &FileName, ) -> Option<Rc<SourceFile>>
Sourcepub fn contents_of_span(&self, span: Span) -> Option<String>
pub fn contents_of_span(&self, span: Span) -> Option<String>
Returns the source contents that is spanned by span.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SourceMap
impl !RefUnwindSafe for SourceMap
impl !Send for SourceMap
impl !Sync for SourceMap
impl Unpin for SourceMap
impl UnwindSafe for SourceMap
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