GraphBuilder

Struct GraphBuilder 

Source
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>

Source

pub fn new(registry: &'r Registry) -> Self

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn node_spec(self, spec: NodeSpec, alias: &str) -> Self

Add a node via a pre-built spec (useful with plugin helpers).

Source

pub fn node_pair<T>(self, pair: T, alias: &str) -> Self
where T: Into<NodeSpec>,

Add a node from an id/version pair (e.g., produced by a plugin helper).

Source

pub fn node_handle_like(self, handle: &dyn NodeHandleLike) -> Self

Add a node using any handle that exposes id/alias.

Source

pub fn node<H>(self, handle: H) -> Self
where H: NodeHandleLike,

Add a node using a typed handle (preferred).

Source

pub fn node_from_id(self, id: &str, alias: &str) -> Self

Add a node by id.

Source

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).

Source

pub fn node_with_compute( self, id: &str, alias: &str, compute: ComputeAffinity, ) -> Self

Add a node with an explicit compute affinity override.

Source

pub fn sync_groups(self, groups: Vec<SyncGroup>) -> Self

Attach sync groups metadata to the most recently added node.

Source

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.

Source

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.

Source

pub fn node_metadata_map<H, K, I>(self, handle: &H, metadata: I) -> Self
where H: NodeHandleLike, K: Into<String>, I: IntoIterator<Item = (K, Value)>,

Bulk metadata helper for a node handle.

Source

pub fn node_metadata_map_by_id<K, I>( self, node_alias: impl Into<String>, metadata: I, ) -> Self
where K: Into<String>, I: IntoIterator<Item = (K, Value)>,

Bulk metadata helper for a node alias.

Source

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.

Source

pub fn host_bridge(self, alias: impl Into<String>) -> Self

Ensure a host-bridge node exists with the provided alias (one per graph).

Source

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.

Source

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.

Source

pub fn connect<F, T>(self, from: F, to: T) -> Self

Source

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.

Source

pub fn edge_metadata<F, T>( self, from: F, to: T, key: impl Into<String>, value: Value, ) -> Self

Attach/override metadata for an existing connection edge.

Source

pub fn connect_handles(self, from: &PortHandle, to: &PortHandle) -> Self

Connect using PortHandle pairs for string-free wiring.

Source

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).

Source

pub fn inputs(self, _ports: &[PortHandle]) -> Self

No-op helpers to mirror the desired API shape for host I/O handles.

Source

pub fn outputs(self, _ports: &[PortHandle]) -> Self

Source

pub fn connect_ports<F, T>(self, from: F, to: T) -> Self

Connect using explicit tuple arguments instead of a colon string, e.g. .connect_ports(("src", "out"), ("dst", "inp")).

Source

pub fn connect_to_nested<F>( self, from: F, nested: &NestedGraphHandle, port: impl AsRef<str>, ) -> Self
where F: IntoPortSpec,

Connect an outer node/port to a nested graph input port.

Source

pub fn connect_from_nested<T>( self, nested: &NestedGraphHandle, port: impl AsRef<str>, to: T, ) -> Self
where T: IntoPortSpec,

Connect a nested graph output port to a node/port in the outer graph.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.