Skip to main content

GraphBuilder

Struct GraphBuilder 

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

Source

pub fn new() -> Self

Create a new empty graph builder.

Source

pub fn add_node(&mut self, type_name: &str, params: &Params) -> usize

Add a node by type name.

Returns the index of the newly added node.

Source

pub fn add_node_with_id( &mut self, type_name: &str, params: &Params, id: u32, ) -> usize

Add a node with an explicit NodeId.

Source

pub fn add_node_with_name( &mut self, type_name: &str, params: &Params, id: u32, name: String, ) -> usize

Add a node with an explicit NodeId and a human-readable name (typically sourced from the JSON name field). The name becomes the program/anchor name in the compiled graph, used by SetParameter routing.

Source

pub fn add_routing_entry( &mut self, idx: usize, from: usize, to: usize, gain: f32, )

Store a routing matrix entry to be applied at build time.

Source

pub fn add_resource(&mut self, resource: GraphResource)

Register a named resource (tape loop, buffer, etc.).

Source

pub fn node_count(&self) -> usize

Number of nodes added to the builder so far.

Source

pub fn set_sample_rate(&mut self, sr: f32)

Set the sample rate for this builder.

Source

pub fn set_parent_ref(&mut self, parent: ActorRef<CommandEnum>)

Set the parent RackCase actor reference (Graph → parent ClockTick).

Source

pub fn connect_signal( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )

Connect signal ports.

Source

pub fn connect_control( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )

Connect control ports (modulation values).

Source

pub fn connect_clock( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )

Connect clock ports (timing events).

Source

pub fn connect_feedback( &mut self, from_node: usize, from_port: usize, to_node: usize, to_port: usize, )

Connect feedback ports (delay lines, state carryover).

Source

pub fn build_ir(self, registry: &Registry<T>) -> Result<GraphIr, BuildError>

Build a rill_lang::graph_ir::GraphIr using the built-in Registry.

This is the new execution path. It looks up each node type in the registry, constructs placeholder IRs, and performs topological sort. Actual compilation to executable programs happens in a future phase.

Source

pub fn ast_from_def( &self, registry: &Registry<T>, ) -> Result<Program, BuildError>

Convert the graph to an rill-lang AST Program.

Each graph node becomes an Expr::Apply with parameters ordered according to the builtin’s BuiltinSig::param_names. Nodes are chained via BinOp::Seq according to their signal connections.

Only simple chain topologies are supported (fan-out/fan-in will return BuildError::UnsupportedTopology).

Source

pub fn compile_def<const BUF: usize>( &self, registry: &Registry<T>, sample_rate: f32, ) -> Result<CompiledGraphEngine<T, BUF>, BuildError>

Compile directly from the graph definition to a CompiledGraphEngine.

Calls ast_from_def followed by rill-lang compilation.

Trait Implementations§

Source§

impl<T: Transcendental, const BUF_SIZE: usize> Default for GraphBuilder<T, BUF_SIZE>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T, const BUF_SIZE: usize> Freeze for GraphBuilder<T, BUF_SIZE>

§

impl<T, const BUF_SIZE: usize> RefUnwindSafe for GraphBuilder<T, BUF_SIZE>
where T: RefUnwindSafe,

§

impl<T, const BUF_SIZE: usize> Send for GraphBuilder<T, BUF_SIZE>

§

impl<T, const BUF_SIZE: usize> Sync for GraphBuilder<T, BUF_SIZE>

§

impl<T, const BUF_SIZE: usize> Unpin for GraphBuilder<T, BUF_SIZE>
where T: Unpin,

§

impl<T, const BUF_SIZE: usize> UnsafeUnpin for GraphBuilder<T, BUF_SIZE>

§

impl<T, const BUF_SIZE: usize> UnwindSafe for GraphBuilder<T, BUF_SIZE>
where T: UnwindSafe,

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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V