pub struct SourceInfoTable { /* private fields */ }
Implementations§
Source§impl SourceInfoTable
impl SourceInfoTable
Sourcepub fn lookup_file_path(&self, file: FileId) -> &PathBuf
pub fn lookup_file_path(&self, file: FileId) -> &PathBuf
Looks up the path of the file with the given id.
§Panics
Panics if the file id does not exist in the file map
Sourcepub fn lookup_position(&self, pos: PositionId) -> &SourceLocation
pub fn lookup_position(&self, pos: PositionId) -> &SourceLocation
Looks up the source location of the position with the given id.
§Panics
Panics if the position id does not exist in the position map
Sourcepub fn get_position(&self, pos: PositionId) -> Option<&SourceLocation>
pub fn get_position(&self, pos: PositionId) -> Option<&SourceLocation>
Looks up the source location of the position with the given id. If no
such position exists, returns None
Sourcepub fn iter_file_map(&self) -> impl Iterator<Item = (&FileId, &PathBuf)>
pub fn iter_file_map(&self) -> impl Iterator<Item = (&FileId, &PathBuf)>
Iterate over the stored file map, returning a tuple of references to the file id and the path
Sourcepub fn iter_file_paths(&self) -> impl Iterator<Item = &PathBuf>
pub fn iter_file_paths(&self) -> impl Iterator<Item = &PathBuf>
Iterate over the paths of all files in the file map
Sourcepub fn iter_file_ids(&self) -> impl Iterator<Item = FileId> + '_
pub fn iter_file_ids(&self) -> impl Iterator<Item = FileId> + '_
Iterate over all file ids in the file map
Sourcepub fn iter_position_map(
&self,
) -> impl Iterator<Item = (&PositionId, &SourceLocation)>
pub fn iter_position_map( &self, ) -> impl Iterator<Item = (&PositionId, &SourceLocation)>
Iterate over the stored position map, returning a tuple of references to the position id and the source location
Sourcepub fn iter_positions(&self) -> impl Iterator<Item = PositionId> + '_
pub fn iter_positions(&self) -> impl Iterator<Item = PositionId> + '_
Iterate over all position ids in the position map
Sourcepub fn iter_source_locations(&self) -> impl Iterator<Item = &SourceLocation>
pub fn iter_source_locations(&self) -> impl Iterator<Item = &SourceLocation>
Iterate over the source locations in the position map
Sourcepub fn add_file(&mut self, file: FileId, path: PathBuf)
pub fn add_file(&mut self, file: FileId, path: PathBuf)
Adds a file to the file map with the given id
Sourcepub fn push_file(&mut self, path: PathBuf) -> FileId
pub fn push_file(&mut self, path: PathBuf) -> FileId
Adds a file to the file map and generates a new file id
for it. If you want to add a file with a specific id, use
SourceInfoTable::add_file
pub fn add_position(&mut self, pos: PositionId, file: FileId, line: LineNum)
Sourcepub fn push_position(&mut self, file: FileId, line: LineNum) -> PositionId
pub fn push_position(&mut self, file: FileId, line: LineNum) -> PositionId
Adds a position to the position map and generates a new position id
for it. If you want to add a position with a specific id, use
SourceInfoTable::add_position
pub fn new<F, P>(files: F, positions: P) -> SourceInfoResult<Self>where
F: IntoIterator<Item = (FileId, PathBuf)>,
P: IntoIterator<Item = (PositionId, FileId, LineNum)>,
pub fn serialize<W: Write>(&self, f: W) -> Result<(), Error>
Trait Implementations§
Source§impl Clone for SourceInfoTable
impl Clone for SourceInfoTable
Source§fn clone(&self) -> SourceInfoTable
fn clone(&self) -> SourceInfoTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SourceInfoTable
impl Debug for SourceInfoTable
Source§impl PartialEq for SourceInfoTable
impl PartialEq for SourceInfoTable
impl Eq for SourceInfoTable
impl StructuralPartialEq for SourceInfoTable
Auto Trait Implementations§
impl Freeze for SourceInfoTable
impl RefUnwindSafe for SourceInfoTable
impl Send for SourceInfoTable
impl Sync for SourceInfoTable
impl Unpin for SourceInfoTable
impl UnwindSafe for SourceInfoTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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