pub struct GraphBuilder { /* private fields */ }Expand description
Accumulates nodes and edges, then freezes them into a Graph.
Every node-adding method takes a per-kind spec and returns self, so a
whole document reads as one chain ending in build.
The builder stamps SCHEMA_VERSION onto the document, so an author never
writes the version by hand.
Implementations§
Source§impl GraphBuilder
impl GraphBuilder
Sourcepub fn branch(self, spec: BranchSpec) -> Self
pub fn branch(self, spec: BranchSpec) -> Self
Adds a branch node from its BranchSpec.
Sourcepub fn edge(self, from: impl Into<String>, to: impl Into<String>) -> Self
pub fn edge(self, from: impl Into<String>, to: impl Into<String>) -> Self
Adds a plain edge from one node id to another.
Sourcepub fn labeled_edge(
self,
from: impl Into<String>,
to: impl Into<String>,
label: impl Into<String>,
) -> Self
pub fn labeled_edge( self, from: impl Into<String>, to: impl Into<String>, label: impl Into<String>, ) -> Self
Adds a labeled edge. The label names the BranchCase this edge
realizes when the source is a branch.
Sourcepub fn build(self) -> Graph
pub fn build(self) -> Graph
Freezes the accumulated nodes and edges into a Graph, stamping the
current SCHEMA_VERSION.
Structure only: run [crate::validate] on the result to check the
semantic rules (hash shape, referential integrity, acyclicity, and the
rest).
Trait Implementations§
Source§impl Clone for GraphBuilder
impl Clone for GraphBuilder
Source§fn clone(&self) -> GraphBuilder
fn clone(&self) -> GraphBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GraphBuilder
impl Debug for GraphBuilder
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 UnsafeUnpin 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