pub struct Module<'a> {
pub root: RegionId,
pub nodes: Vec<Node<'a>>,
pub regions: Vec<Region<'a>>,
pub terms: Vec<Term<'a>>,
}
Expand description
A module consisting of a hugr graph together with terms.
See ast::Module
for the AST representation.
Fields§
§root: RegionId
The id of the root region.
nodes: Vec<Node<'a>>
Table of Node
s.
regions: Vec<Region<'a>>
Table of Region
s.
terms: Vec<Term<'a>>
Table of Term
s.
Implementations§
Source§impl<'a> Module<'a>
impl<'a> Module<'a>
Sourcepub fn get_node(&self, node_id: NodeId) -> Option<&Node<'a>>
pub fn get_node(&self, node_id: NodeId) -> Option<&Node<'a>>
Return the node data for a given node id.
Sourcepub fn get_node_mut(&mut self, node_id: NodeId) -> Option<&mut Node<'a>>
pub fn get_node_mut(&mut self, node_id: NodeId) -> Option<&mut Node<'a>>
Return a mutable reference to the node data for a given node id.
Sourcepub fn insert_node(&mut self, node: Node<'a>) -> NodeId
pub fn insert_node(&mut self, node: Node<'a>) -> NodeId
Insert a new node into the module and return its id.
Sourcepub fn get_term(&self, term_id: TermId) -> Option<&Term<'a>>
pub fn get_term(&self, term_id: TermId) -> Option<&Term<'a>>
Return the term data for a given term id.
Returns Term::Wildcard
when the term id is invalid.
Sourcepub fn get_term_mut(&mut self, term_id: TermId) -> Option<&mut Term<'a>>
pub fn get_term_mut(&mut self, term_id: TermId) -> Option<&mut Term<'a>>
Return a mutable reference to the term data for a given term id.
Sourcepub fn insert_term(&mut self, term: Term<'a>) -> TermId
pub fn insert_term(&mut self, term: Term<'a>) -> TermId
Insert a new term into the module and return its id.
Sourcepub fn get_region(&self, region_id: RegionId) -> Option<&Region<'a>>
pub fn get_region(&self, region_id: RegionId) -> Option<&Region<'a>>
Return the region data for a given region id.
Sourcepub fn get_region_mut(&mut self, region_id: RegionId) -> Option<&mut Region<'a>>
pub fn get_region_mut(&mut self, region_id: RegionId) -> Option<&mut Region<'a>>
Return a mutable reference to the region data for a given region id.
Sourcepub fn insert_region(&mut self, region: Region<'a>) -> RegionId
pub fn insert_region(&mut self, region: Region<'a>) -> RegionId
Insert a new region into the module and return its id.
Trait Implementations§
impl<'a> Eq for Module<'a>
impl<'a> StructuralPartialEq for Module<'a>
Auto Trait Implementations§
impl<'a> Freeze for Module<'a>
impl<'a> RefUnwindSafe for Module<'a>
impl<'a> Send for Module<'a>
impl<'a> Sync for Module<'a>
impl<'a> Unpin for Module<'a>
impl<'a> UnwindSafe for Module<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
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>
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 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>
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