pub struct GraphBuilder { /* private fields */ }Expand description
Accumulates vertices and edges before they are frozen into CSR form.
Split from DepGraph so beck-infra can add the resource vertices — it depends on
beck-core, not the other way round — without either crate knowing the other’s node kinds.
Implementations§
Source§impl GraphBuilder
impl GraphBuilder
pub fn new() -> GraphBuilder
Sourcepub fn node(&mut self, node: GraphNode) -> NodeId
pub fn node(&mut self, node: GraphNode) -> NodeId
Add a vertex, or return the existing one if the name is already known.
pub fn id(&self, name: &str) -> Option<NodeId>
pub fn edge(&mut self, from: NodeId, to: NodeId, kind: EdgeKind)
Sourcepub fn edge_to_name(&mut self, from: NodeId, to: &str, kind: EdgeKind)
pub fn edge_to_name(&mut self, from: NodeId, to: &str, kind: EdgeKind)
Add an edge to a name, if that name is a vertex. Silently ignores unknown names: a body mentions prims and locals as well as globals, and those are not vertices.
Trait Implementations§
Source§impl Default for GraphBuilder
impl Default for GraphBuilder
Source§fn default() -> GraphBuilder
fn default() -> GraphBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GraphBuilder
impl RefUnwindSafe for GraphBuilder
impl Send for GraphBuilder
impl Sync for GraphBuilder
impl Unpin for GraphBuilder
impl UnwindSafe for GraphBuilder
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