pub struct BorrowGraph<Loc: Copy, Lbl: Clone + Ord>(/* private fields */);Implementations§
Source§impl<Loc: Copy, Lbl: Clone + Ord> BorrowGraph<Loc, Lbl>
impl<Loc: Copy, Lbl: Clone + Ord> BorrowGraph<Loc, Lbl>
Sourcepub fn is_mutable(&self, id: RefID) -> bool
pub fn is_mutable(&self, id: RefID) -> bool
checks if the given reference is mutable or not
Sourcepub fn new_ref(&mut self, id: RefID, mutable: bool)
pub fn new_ref(&mut self, id: RefID, mutable: bool)
Adds a new reference to the borrow graph Fails if the id is already in use
Sourcepub fn borrowed_by(
&self,
id: RefID,
) -> (BTreeMap<RefID, Loc>, BTreeMap<Lbl, BTreeMap<RefID, Loc>>)
pub fn borrowed_by( &self, id: RefID, ) -> (BTreeMap<RefID, Loc>, BTreeMap<Lbl, BTreeMap<RefID, Loc>>)
Return the references borrowing the id reference
The borrows are collected by first label in the borrow edge
BTreeMap<RefID, Loc> represents all of the “full” or “epsilon” borrows (non field borrows)
BTreeMap<Lbl, BTreeMap<RefID, Loc>>) represents the field borrows, collected over the
first label
Sourcepub fn between_edges(
&self,
parent: RefID,
child: RefID,
) -> Vec<(Loc, Vec<Lbl>, bool)>
pub fn between_edges( &self, parent: RefID, child: RefID, ) -> Vec<(Loc, Vec<Lbl>, bool)>
Return the edges between parent and child
Sourcepub fn out_edges(&self, id: RefID) -> Vec<(Loc, Vec<Lbl>, bool, RefID)>
pub fn out_edges(&self, id: RefID) -> Vec<(Loc, Vec<Lbl>, bool, RefID)>
Return the outgoing edges from id
Sourcepub fn in_edges(&self, id: RefID) -> Vec<(Loc, RefID, Vec<Lbl>, bool)>
pub fn in_edges(&self, id: RefID) -> Vec<(Loc, RefID, Vec<Lbl>, bool)>
Return the incoming edges into id
Sourcepub fn add_strong_borrow(&mut self, loc: Loc, parent_id: RefID, child_id: RefID)
pub fn add_strong_borrow(&mut self, loc: Loc, parent_id: RefID, child_id: RefID)
Add a strong (exact) epsilon borrow from parent_id to child_id
Sourcepub fn add_strong_field_borrow(
&mut self,
loc: Loc,
parent_id: RefID,
field: Lbl,
child_id: RefID,
)
pub fn add_strong_field_borrow( &mut self, loc: Loc, parent_id: RefID, field: Lbl, child_id: RefID, )
Add a strong (exact) field borrow from parent_id to child_id at field field
Sourcepub fn add_weak_borrow(&mut self, loc: Loc, parent_id: RefID, child_id: RefID)
pub fn add_weak_borrow(&mut self, loc: Loc, parent_id: RefID, child_id: RefID)
Add a weak (prefix) epsilon borrow from parent_id to child_id
i.e. child_id might be borrowing from ANY field in parent_id
Sourcepub fn add_weak_field_borrow(
&mut self,
loc: Loc,
parent_id: RefID,
field: Lbl,
child_id: RefID,
)
pub fn add_weak_field_borrow( &mut self, loc: Loc, parent_id: RefID, field: Lbl, child_id: RefID, )
Add a weak (prefix) field borrow from parent_id to child_id at field field
i.e. child_id might be borrowing from ANY field in parent_id rooted at field
Sourcepub fn release(&mut self, id: RefID)
pub fn release(&mut self, id: RefID)
Remove reference id from the graph
Fixes any transitive borrows, so if parent borrowed by id borrowed by child
After the release, parent borrowed by child
Sourcepub fn remap_refs(&mut self, id_map: &BTreeMap<RefID, RefID>)
pub fn remap_refs(&mut self, id_map: &BTreeMap<RefID, RefID>)
Utility for remapping the reference ids according the id_map provided
If it is not in the map, the id remains the same
Sourcepub fn join(&self, other: &Self) -> Self
pub fn join(&self, other: &Self) -> Self
Joins other into self It adds only ‘unmatched’ edges from other into self, i.e. for any edge in other, if there is an edge in self that is <= than that edge, it is not added.
Sourcepub fn contains_id(&self, ref_id: RefID) -> bool
pub fn contains_id(&self, ref_id: RefID) -> bool
Checks if the current reference is in the graph
Trait Implementations§
Source§impl<Loc: Clone + Copy, Lbl: Clone + Clone + Ord> Clone for BorrowGraph<Loc, Lbl>
impl<Loc: Clone + Copy, Lbl: Clone + Clone + Ord> Clone for BorrowGraph<Loc, Lbl>
Source§fn clone(&self) -> BorrowGraph<Loc, Lbl>
fn clone(&self) -> BorrowGraph<Loc, Lbl>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more