pub struct GraphBuilder { /* private fields */ }Expand description
Mutable scratch state for assembling a dynamic graph inside a GraphDsl
closure.
Tracks registered stages, their ports, the edges wired between them, and any
deferred wiring errors (raised by wire, which collects rather than
short-circuits). finish consumes it into a validated GraphBlueprint.
Use this builder for cycles, runtime-data-dependent topology, erased
interop, connect_any, and method-based wire construction. For static
typed graphs where double-wiring should be rejected by Rust moves, use
TypedGraphBuilder.
Implementations§
Source§impl GraphBuilder
impl GraphBuilder
pub fn add<G: GraphStage>(&mut self, stage: G) -> G::Shape
pub fn add_with_attributes<G: GraphStage>( &mut self, stage: G, attributes: Attributes, ) -> G::Shape
pub fn add_named<G: GraphStage>( &mut self, stage: G, name: impl Into<String>, ) -> G::Shape
pub fn connect<T: 'static>( &mut self, outlet: Outlet<T>, inlet: Inlet<T>, ) -> StreamResult<()>
Sourcepub fn connect_any(
&mut self,
outlet: AnyOutlet,
inlet: AnyInlet,
) -> StreamResult<()>
pub fn connect_any( &mut self, outlet: AnyOutlet, inlet: AnyInlet, ) -> StreamResult<()>
Connect type-erased ports for dynamic graph construction and interop.
This remains an explicit compatibility surface for cases where the
element type is only known at runtime. Prefer connect
or TypedGraphBuilder for static Rust
graphs.
pub fn import<S: Shape>(&mut self, graph: &PartialGraph<S>) -> StreamResult<S>
Sourcepub fn wire<W: WireSpec>(&mut self, spec: W) -> &mut Self
pub fn wire<W: WireSpec>(&mut self, spec: W) -> &mut Self
Apply a dynamic/method-based wiring spec, deferring errors to finish.
wire is useful for graph DSL ergonomics and interop-style topology
construction. Static Rust graphs can use TypedGraphBuilder when
compile-time double-wire rejection is desired.
Sourcepub fn try_wire<W: WireSpec>(&mut self, spec: W) -> StreamResult<&mut Self>
pub fn try_wire<W: WireSpec>(&mut self, spec: W) -> StreamResult<&mut Self>
Apply a dynamic/method-based wiring spec, returning wiring errors immediately.
This is the fallible counterpart to wire and remains a
runtime-validated dynamic/interop surface.