#[non_exhaustive]pub struct StackGraph {
pub nodes: BTreeMap<NodeId, StackNode>,
pub edges: BTreeMap<NodeId, BTreeMap<NodeId, i64>>,
}Expand description
The stack graph: every push/pop/scope node plus the paths between them.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.nodes: BTreeMap<NodeId, StackNode>Every node, keyed by id.
edges: BTreeMap<NodeId, BTreeMap<NodeId, i64>>Adjacency: source id -> sink id -> the edge’s precedence.
Implementations§
Source§impl StackGraph
impl StackGraph
Sourcepub fn add_node(&mut self, id: NodeId, node: StackNode)
pub fn add_node(&mut self, id: NodeId, node: StackNode)
Inserts node under id, replacing any node already there.
Sourcepub fn add_edge(&mut self, source: NodeId, sink: NodeId, precedence: i64)
pub fn add_edge(&mut self, source: NodeId, sink: NodeId, precedence: i64)
Connects source to sink, keeping the higher precedence on repeat.
Sourcepub fn successors(&self, id: NodeId) -> Vec<(NodeId, i64)>
pub fn successors(&self, id: NodeId) -> Vec<(NodeId, i64)>
id’s outgoing edges, as (sink, precedence) pairs.
Sourcepub fn predecessors(&self, id: NodeId) -> Vec<NodeId>
pub fn predecessors(&self, id: NodeId) -> Vec<NodeId>
Ids of every node with an edge into id.
Trait Implementations§
Source§impl Clone for StackGraph
impl Clone for StackGraph
Source§impl Debug for StackGraph
impl Debug for StackGraph
Source§impl Default for StackGraph
impl Default for StackGraph
impl Eq for StackGraph
Source§impl PartialEq for StackGraph
impl PartialEq for StackGraph
impl StructuralPartialEq for StackGraph
Auto Trait Implementations§
impl Forget for StackGraph
impl Freeze for StackGraph
impl RefUnwindSafe for StackGraph
impl Send for StackGraph
impl Sync for StackGraph
impl Unpin for StackGraph
impl UnsafeUnpin for StackGraph
impl UnwindSafe for StackGraph
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