pub struct SourceMap {
pub base_path: PathBuf,
pub cache: SeqMap<FileId, FileInfo>,
pub next_file_id: FileId,
}
Fields§
§base_path: PathBuf
§cache: SeqMap<FileId, FileInfo>
§next_file_id: FileId
Implementations§
Source§impl SourceMap
impl SourceMap
pub fn new(base_path: &Path) -> Self
pub fn base_path(&self) -> &Path
pub fn read_file(&mut self, path: &Path) -> Result<(FileId, String)>
pub fn add_manual(&mut self, id: FileId, relative_path: &Path, contents: &str)
pub fn add_manual_no_id( &mut self, relative_path: &Path, contents: &str, ) -> FileId
pub fn read_file_relative( &mut self, relative_path: &str, ) -> Result<(FileId, String)>
pub fn get_span_source( &self, file_id: FileId, offset: usize, length: usize, ) -> &str
pub fn get_source_line( &self, file_id: FileId, line_number: usize, ) -> Option<&str>
pub fn get_span_location_utf8( &self, file_id: FileId, offset: usize, ) -> (usize, usize)
pub fn fetch_relative_filename(&self, file_id: FileId) -> &str
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