pub struct SourceMap {
inner: RefCell<SourceMapInner>,
}
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.
Fields§
§inner: RefCell<SourceMapInner>
The actual source map data.
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.
Sourcefn find_source_file_index(&self, pos: u32) -> Option<usize>
fn find_source_file_index(&self, pos: u32) -> Option<usize>
Find the index for the source file containing pos
.
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
.
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more