Skip to main content

node_ctor

Macro node_ctor 

Source
macro_rules! node_ctor {
    ($registry:expr, $type_name:expr, $ctor:expr) => { ... };
}
Expand description

Register a node constructor by type name.

Shorthand for NodeRegistry::register_fn. Emits a call to registry.register_fn(type_name, closure).

ยงExample

use rill_graph::{node_ctor, NodeRegistry};
use rill_core::traits::{NodeId, NodeParams, NodeVariant, Source, SignalNode};

// Inside a function that has access to a &mut NodeRegistry<f32, 64>:
fn register(registry: &mut NodeRegistry<f32, 64>) {
    node_ctor!(registry, "test/my_source", |id, params| {
        // construct and return NodeVariant
        todo!()
    });
}