Skip to main content

NodeFactory

Trait NodeFactory 

Source
pub trait NodeFactory: Send + Sync {
    // Required methods
    fn signatures(&self) -> Vec<FuncSig>;
    fn build(
        &self,
        name: &str,
        wire_count: usize,
        consts: &[FactoryArg],
    ) -> Result<Box<dyn PolydatNode>, String>;
}
Expand description

Trait for external node providers.

External crates implement this to contribute Polydat node functions. Once registered on a PolydatRuntime, the factory’s nodes are indistinguishable from built-in nodes: same registry, same describe output, same category grouping, same type checking.

Required Methods§

Source

fn signatures(&self) -> Vec<FuncSig>

Return signatures for all functions this factory provides.

Called once at registration time. The returned signatures are merged into the runtime’s unified registry.

Source

fn build( &self, name: &str, wire_count: usize, consts: &[FactoryArg], ) -> Result<Box<dyn PolydatNode>, String>

Build a node by name with the given constant arguments.

Called by the compiler when assembling a kernel that references one of this factory’s functions. wire_count is the number of wire inputs at the call site.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§