pub struct GraphBuilder<'r> { /* private fields */ }Expand description
Graph builder with alias and basic port validation using the registry.
Implementations§
Source§impl<'r> GraphBuilder<'r>
impl<'r> GraphBuilder<'r>
pub fn new(registry: &'r Registry) -> Self
Sourcepub fn graph_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn graph_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Attach string graph-level metadata to the built graph (Graph.metadata).
For typed graph metadata visible to nodes at runtime, prefer graph_metadata_value.
Sourcepub fn graph_metadata_value(self, key: impl Into<String>, value: Value) -> Self
pub fn graph_metadata_value(self, key: impl Into<String>, value: Value) -> Self
Attach graph-level metadata (typed Value) to the built graph (Graph.metadata_values).
Nodes can read this via ExecutionContext.graph_metadata at runtime.
Sourcepub fn inject_node_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn inject_node_metadata(self, key: impl Into<String>, value: Value) -> Self
Inject a key/value into every node’s metadata, without overwriting existing keys.
This is the ergonomic way to “broadcast” host-provided metadata to all nodes so it shows up
in each node’s ExecutionContext.metadata at runtime.
Sourcepub fn inject_node_metadata_overwrite(
self,
key: impl Into<String>,
value: Value,
) -> Self
pub fn inject_node_metadata_overwrite( self, key: impl Into<String>, value: Value, ) -> Self
Inject a key/value into every node’s metadata, overwriting existing keys.
Sourcepub fn node_spec(self, spec: NodeSpec, alias: &str) -> Self
pub fn node_spec(self, spec: NodeSpec, alias: &str) -> Self
Add a node via a pre-built spec (useful with plugin helpers).
Sourcepub fn node_pair<T>(self, pair: T, alias: &str) -> Self
pub fn node_pair<T>(self, pair: T, alias: &str) -> Self
Add a node from an id/version pair (e.g., produced by a plugin helper).
Sourcepub fn node_handle_like(self, handle: &dyn NodeHandleLike) -> Self
pub fn node_handle_like(self, handle: &dyn NodeHandleLike) -> Self
Add a node using any handle that exposes id/alias.
Sourcepub fn node<H>(self, handle: H) -> Selfwhere
H: NodeHandleLike,
pub fn node<H>(self, handle: H) -> Selfwhere
H: NodeHandleLike,
Add a node using a typed handle (preferred).
Sourcepub fn node_from_id(self, id: &str, alias: &str) -> Self
pub fn node_from_id(self, id: &str, alias: &str) -> Self
Add a node by id.
Sourcepub fn node_id(self, id: &str, alias: &str) -> Self
pub fn node_id(self, id: &str, alias: &str) -> Self
Add a node using its descriptor default compute affinity (or override via node_with_compute).
Sourcepub fn node_with_compute(
self,
id: &str,
alias: &str,
compute: ComputeAffinity,
) -> Self
pub fn node_with_compute( self, id: &str, alias: &str, compute: ComputeAffinity, ) -> Self
Add a node with an explicit compute affinity override.
Sourcepub fn sync_groups(self, groups: Vec<SyncGroup>) -> Self
pub fn sync_groups(self, groups: Vec<SyncGroup>) -> Self
Attach sync groups metadata to the most recently added node.
Sourcepub fn node_metadata(
self,
handle: &impl NodeHandleLike,
key: impl Into<String>,
value: Value,
) -> Self
pub fn node_metadata( self, handle: &impl NodeHandleLike, key: impl Into<String>, value: Value, ) -> Self
Attach or override metadata for a node handle. Values can store arbitrary UI hints (e.g. positions, styles) without changing core types.
Sourcepub fn node_metadata_by_id(
self,
node_alias: impl Into<String>,
key: impl Into<String>,
value: Value,
) -> Self
pub fn node_metadata_by_id( self, node_alias: impl Into<String>, key: impl Into<String>, value: Value, ) -> Self
Attach or override metadata for a node alias. Values can store arbitrary UI hints (e.g. positions, styles) without changing core types.
Sourcepub fn node_metadata_map<H, K, I>(self, handle: &H, metadata: I) -> Self
pub fn node_metadata_map<H, K, I>(self, handle: &H, metadata: I) -> Self
Bulk metadata helper for a node handle.
Sourcepub fn node_metadata_map_by_id<K, I>(
self,
node_alias: impl Into<String>,
metadata: I,
) -> Self
pub fn node_metadata_map_by_id<K, I>( self, node_alias: impl Into<String>, metadata: I, ) -> Self
Bulk metadata helper for a node alias.
Sourcepub fn const_input(self, port: &PortHandle, value: Option<Value>) -> Self
pub fn const_input(self, port: &PortHandle, value: Option<Value>) -> Self
Set or unset a constant value for a node alias/port. None unsets/ignores default.
Sourcepub fn host_bridge(self, alias: impl Into<String>) -> Self
pub fn host_bridge(self, alias: impl Into<String>) -> Self
Ensure a host-bridge node exists with the provided alias (one per graph).
Sourcepub fn const_input_by_id(
self,
node_alias: impl Into<String>,
port: impl Into<String>,
value: Option<Value>,
) -> Self
pub fn const_input_by_id( self, node_alias: impl Into<String>, port: impl Into<String>, value: Option<Value>, ) -> Self
Set or unset a constant value by explicit id/port tuple.
Sourcepub fn nest(
self,
nested: &NestedGraph,
alias: impl Into<String>,
) -> (Self, NestedGraphHandle)
pub fn nest( self, nested: &NestedGraph, alias: impl Into<String>, ) -> (Self, NestedGraphHandle)
Inline another graph by prefixing node labels with alias and wiring its host bridge
to return a handle representing the nested inputs/outputs.
pub fn connect<F, T>(self, from: F, to: T) -> Selfwhere
F: IntoPortSpec,
T: IntoPortSpec,
Sourcepub fn connect_with_metadata<F, T, K>(
self,
from: F,
to: T,
metadata: impl IntoIterator<Item = (K, Value)>,
) -> Self
pub fn connect_with_metadata<F, T, K>( self, from: F, to: T, metadata: impl IntoIterator<Item = (K, Value)>, ) -> Self
Connect two ports and attach metadata to the edge.
Sourcepub fn edge_metadata<F, T>(
self,
from: F,
to: T,
key: impl Into<String>,
value: Value,
) -> Selfwhere
F: IntoPortSpec,
T: IntoPortSpec,
pub fn edge_metadata<F, T>(
self,
from: F,
to: T,
key: impl Into<String>,
value: Value,
) -> Selfwhere
F: IntoPortSpec,
T: IntoPortSpec,
Attach/override metadata for an existing connection edge.
Sourcepub fn connect_handles(self, from: &PortHandle, to: &PortHandle) -> Self
pub fn connect_handles(self, from: &PortHandle, to: &PortHandle) -> Self
Connect using PortHandle pairs for string-free wiring.
Sourcepub fn connect_by_id(
self,
from: (impl Into<String>, impl Into<String>),
to: (impl Into<String>, impl Into<String>),
) -> Self
pub fn connect_by_id( self, from: (impl Into<String>, impl Into<String>), to: (impl Into<String>, impl Into<String>), ) -> Self
Connect by explicit id/port tuples (old-style, but structured).
Sourcepub fn inputs(self, _ports: &[PortHandle]) -> Self
pub fn inputs(self, _ports: &[PortHandle]) -> Self
No-op helpers to mirror the desired API shape for host I/O handles.
pub fn outputs(self, _ports: &[PortHandle]) -> Self
Sourcepub fn connect_ports<F, T>(self, from: F, to: T) -> Selfwhere
F: IntoPortSpec,
T: IntoPortSpec,
pub fn connect_ports<F, T>(self, from: F, to: T) -> Selfwhere
F: IntoPortSpec,
T: IntoPortSpec,
Connect using explicit tuple arguments instead of a colon string, e.g.
.connect_ports(("src", "out"), ("dst", "inp")).
Sourcepub fn connect_to_nested<F>(
self,
from: F,
nested: &NestedGraphHandle,
port: impl AsRef<str>,
) -> Selfwhere
F: IntoPortSpec,
pub fn connect_to_nested<F>(
self,
from: F,
nested: &NestedGraphHandle,
port: impl AsRef<str>,
) -> Selfwhere
F: IntoPortSpec,
Connect an outer node/port to a nested graph input port.
Sourcepub fn connect_from_nested<T>(
self,
nested: &NestedGraphHandle,
port: impl AsRef<str>,
to: T,
) -> Selfwhere
T: IntoPortSpec,
pub fn connect_from_nested<T>(
self,
nested: &NestedGraphHandle,
port: impl AsRef<str>,
to: T,
) -> Selfwhere
T: IntoPortSpec,
Connect a nested graph output port to a node/port in the outer graph.
pub fn build(self) -> Graph
Auto Trait Implementations§
impl<'r> Freeze for GraphBuilder<'r>
impl<'r> !RefUnwindSafe for GraphBuilder<'r>
impl<'r> Send for GraphBuilder<'r>
impl<'r> Sync for GraphBuilder<'r>
impl<'r> Unpin for GraphBuilder<'r>
impl<'r> !UnwindSafe for GraphBuilder<'r>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more