pub struct Module { /* private fields */ }Expand description
A module.
This is the root node of an LLHD intermediate representation. Contains
Function, Process, and Entity declarations and definitions.
Implementations§
Source§impl Module
impl Module
Sourcepub fn dump(&self) -> ModuleDumper<'_>
pub fn dump(&self) -> ModuleDumper<'_>
Dump the module in human-readable form.
Sourcepub fn remove_unit(&mut self, unit: UnitId)
pub fn remove_unit(&mut self, unit: UnitId)
Remove a unit from the module.
Sourcepub fn remove_decl(&mut self, decl: DeclId)
pub fn remove_decl(&mut self, decl: DeclId)
Remove a declaration from the module.
Sourcepub fn units<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
pub fn units<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
Return an iterator over the units in this module.
Sourcepub fn units_mut<'a>(&'a mut self) -> impl Iterator<Item = UnitBuilder<'a>> + 'a
pub fn units_mut<'a>(&'a mut self) -> impl Iterator<Item = UnitBuilder<'a>> + 'a
Return a mutable iterator over the units in this module.
Sourcepub fn par_units<'a>(&'a self) -> impl ParallelIterator<Item = Unit<'a>> + 'a
pub fn par_units<'a>(&'a self) -> impl ParallelIterator<Item = Unit<'a>> + 'a
Return a parallel iterator over the units in this module.
Sourcepub fn par_units_mut<'a>(
&'a mut self,
) -> impl ParallelIterator<Item = UnitBuilder<'a>> + 'a
pub fn par_units_mut<'a>( &'a mut self, ) -> impl ParallelIterator<Item = UnitBuilder<'a>> + 'a
Return a parallel mutable iterator over the units in this module.
Sourcepub fn functions<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
pub fn functions<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
Return an iterator over the functions in this module.
Sourcepub fn processes<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
pub fn processes<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
Return an iterator over the processes in this module.
Sourcepub fn entities<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
pub fn entities<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a
Return an iterator over the entities in this module.
Sourcepub fn decls<'a>(&'a self) -> impl Iterator<Item = DeclId> + 'a
pub fn decls<'a>(&'a self) -> impl Iterator<Item = DeclId> + 'a
Return an iterator over the external unit declarations in this module.
Sourcepub fn unit_mut(&mut self, unit: UnitId) -> UnitBuilder<'_>
pub fn unit_mut(&mut self, unit: UnitId) -> UnitBuilder<'_>
Return a mutable unit in the module.
Sourcepub fn symbols<'a>(
&'a self,
) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
pub fn symbols<'a>( &'a self, ) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
Return an iterator over the symbols in the module.
Sourcepub fn local_symbols<'a>(
&'a self,
) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
pub fn local_symbols<'a>( &'a self, ) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
Return an iterator over the local symbols in the module.
Sourcepub fn global_symbols<'a>(
&'a self,
) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
pub fn global_symbols<'a>( &'a self, ) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
Return an iterator over the global symbols in the module.
Sourcepub fn is_linked(&self) -> bool
pub fn is_linked(&self) -> bool
Check whether the module is internally linked.
Adding or modifying a unit invalidates the linkage within the module.
Sourcepub fn lookup_ext_unit(
&self,
ext_unit: ExtUnit,
within: UnitId,
) -> Option<LinkedUnit>
pub fn lookup_ext_unit( &self, ext_unit: ExtUnit, within: UnitId, ) -> Option<LinkedUnit>
Lookup what an external unit links to.
The module must be linked for this to work.
Sourcepub fn set_location_hint(&mut self, mod_unit: UnitId, loc: usize)
pub fn set_location_hint(&mut self, mod_unit: UnitId, loc: usize)
Add a location hint to a unit.
Annotates the byte offset of a unit in the input file.
Sourcepub fn location_hint(&self, mod_unit: UnitId) -> Option<usize>
pub fn location_hint(&self, mod_unit: UnitId) -> Option<usize>
Get the location hint associated with a unit.
Returns the byte offset of the unit in the input file, or None if there is no hint for the value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Module
impl<'de> Deserialize<'de> for Module
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
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> 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