calyx_frontend::source_info

Struct SourceInfoTable

Source
pub struct SourceInfoTable { /* private fields */ }

Implementations§

Source§

impl SourceInfoTable

Source

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

Source

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

Source

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

Source

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

Source

pub fn iter_file_paths(&self) -> impl Iterator<Item = &PathBuf>

Iterate over the paths of all files in the file map

Source

pub fn iter_file_ids(&self) -> impl Iterator<Item = FileId> + '_

Iterate over all file ids in the file map

Source

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

Source

pub fn iter_positions(&self) -> impl Iterator<Item = PositionId> + '_

Iterate over all position ids in the position map

Source

pub fn iter_source_locations(&self) -> impl Iterator<Item = &SourceLocation>

Iterate over the source locations in the position map

Source

pub fn add_file(&mut self, file: FileId, path: PathBuf)

Adds a file to the file map with the given id

Source

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

Source

pub fn add_position(&mut self, pos: PositionId, file: FileId, line: LineNum)

Source

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

Source

pub fn new_empty() -> Self

Creates a new empty source info table

Source

pub fn new<F, P>(files: F, positions: P) -> SourceInfoResult<Self>
where F: IntoIterator<Item = (FileId, PathBuf)>, P: IntoIterator<Item = (PositionId, FileId, LineNum)>,

Source

pub fn serialize<W: Write>(&self, f: W) -> Result<(), Error>

Trait Implementations§

Source§

impl Clone for SourceInfoTable

Source§

fn clone(&self) -> SourceInfoTable

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SourceInfoTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SourceInfoTable

Source§

fn eq(&self, other: &SourceInfoTable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SourceInfoTable

Source§

impl StructuralPartialEq for SourceInfoTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.