pub struct SourceMap { /* private fields */ }Expand description
All source files of one compilation.
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn add(&mut self, name: impl Into<String>, text: String) -> FileId
pub fn add(&mut self, name: impl Into<String>, text: String) -> FileId
Adds a file and returns its id. The caller must ensure text.len() <= MAX_FILE_SIZE;
longer text is truncated at a character boundary.
Sourcepub fn get(&self, id: FileId) -> Option<&SourceFile>
pub fn get(&self, id: FileId) -> Option<&SourceFile>
The file with the given id, if it exists.
Sourcepub fn iter(&self) -> impl Iterator<Item = (FileId, &SourceFile)>
pub fn iter(&self) -> impl Iterator<Item = (FileId, &SourceFile)>
Iterates over all files with their ids.
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 UnsafeUnpin 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