pub struct GraphBuilder<T: Transcendental, const BUF_SIZE: usize> { /* private fields */ }Expand description
Mutable builder for an immutable signal graph.
Implementations§
Source§impl<T: Transcendental, const BUF_SIZE: usize> GraphBuilder<T, BUF_SIZE>
impl<T: Transcendental, const BUF_SIZE: usize> GraphBuilder<T, BUF_SIZE>
pub fn new() -> Self
pub fn add_source(&mut self, source: Box<dyn Source<T, BUF_SIZE>>) -> usize
pub fn add_processor( &mut self, processor: Box<dyn Processor<T, BUF_SIZE>>, ) -> usize
pub fn add_sink(&mut self, sink: Box<dyn Sink<T, BUF_SIZE>>) -> usize
Sourcepub fn add_node(
&mut self,
registry: &NodeRegistry<T, BUF_SIZE>,
type_name: &str,
params: &NodeParams,
) -> Result<usize, RegistryError>
pub fn add_node( &mut self, registry: &NodeRegistry<T, BUF_SIZE>, type_name: &str, params: &NodeParams, ) -> Result<usize, RegistryError>
Add a node by type name via the registry.
Looks up the type name in registry, calls its
[NodeConstructor::construct], and pushes the resulting
NodeVariant into the graph. The node’s NodeId is
automatically assigned from its position in the graph.
Returns the index of the newly added node.
Sourcepub fn add_node_with_id(
&mut self,
registry: &NodeRegistry<T, BUF_SIZE>,
type_name: &str,
params: &NodeParams,
id: NodeId,
) -> Result<usize, RegistryError>
pub fn add_node_with_id( &mut self, registry: &NodeRegistry<T, BUF_SIZE>, type_name: &str, params: &NodeParams, id: NodeId, ) -> Result<usize, RegistryError>
Add a node with an explicit NodeId.
Unlike add_node which auto-assigns IDs, this
method uses the provided id directly. Important for serialization
where external references (e.g. patchbay bindings) depend on exact IDs.
Returns the index (position) of the newly added node.
§Panics
If id duplicates a previously registered ID the error is reported
by the caller — this method does not check for duplicates.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes added so far.
Sourcepub fn connect_signal(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_signal( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect signal output port from_port of node from_node
to signal input port to_port of node to_node.
Sourcepub fn connect_control(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_control( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect a control output to a control input.
Sourcepub fn connect_clock(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_clock( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect a clock output to a clock input.
Sourcepub fn connect_feedback(
&mut self,
from_node: usize,
from_port: usize,
to_node: usize,
to_port: usize,
)
pub fn connect_feedback( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )
Connect a feedback output to a feedback input. This creates a feedback path (previous output → current input).
Sourcepub fn build(
self,
clock_source: Box<dyn ClockSource>,
) -> Result<SignalGraph<T, BUF_SIZE>, BuildError>
pub fn build( self, clock_source: Box<dyn ClockSource>, ) -> Result<SignalGraph<T, BUF_SIZE>, BuildError>
Build the immutable SignalGraph.