Skip to main content

NodeRegistry

Struct NodeRegistry 

Source
pub struct NodeRegistry { /* private fields */ }
Expand description

Global node registry — populated at startup via register!.

Implementations§

Source§

impl NodeRegistry

Source

pub fn new() -> Self

Source

pub fn register(&mut self, entry: NodeEntry)

Register a node type.

Source

pub fn create(&self, type_name: &str) -> Option<Box<dyn DspNode>>

Instantiate a node by type name. Returns None if not registered.

Examples found in repository?
examples/registry_demo.rs (line 33)
8fn main() {
9    let registry = builtin_registry();
10
11    println!("=== AetherSDK Node Registry ===\n");
12    println!("Registered nodes: {}\n", registry.len());
13
14    for name in registry.list() {
15        let defs = registry.param_defs(name).unwrap_or(&[]);
16        println!("  {name}");
17        for d in defs {
18            println!("    • {:<16} [{:>7.1} – {:>7.1}]  default: {:.3}",
19                d.name, d.min, d.max, d.default);
20        }
21    }
22
23    println!("\n=== JSON Schema (first 20 lines) ===\n");
24    let schema = schema_to_json(&registry);
25    for line in schema.lines().take(20) {
26        println!("{line}");
27    }
28    println!("...");
29
30    // Demonstrate instantiation
31    println!("\n=== Instantiation Test ===\n");
32    for name in registry.list() {
33        let node = registry.create(name);
34        println!("  {} → {}", name, if node.is_some() { "✓" } else { "✗" });
35    }
36}
Source

pub fn list(&self) -> Vec<&'static str>

List all registered node type names.

Examples found in repository?
examples/registry_demo.rs (line 14)
8fn main() {
9    let registry = builtin_registry();
10
11    println!("=== AetherSDK Node Registry ===\n");
12    println!("Registered nodes: {}\n", registry.len());
13
14    for name in registry.list() {
15        let defs = registry.param_defs(name).unwrap_or(&[]);
16        println!("  {name}");
17        for d in defs {
18            println!("    • {:<16} [{:>7.1} – {:>7.1}]  default: {:.3}",
19                d.name, d.min, d.max, d.default);
20        }
21    }
22
23    println!("\n=== JSON Schema (first 20 lines) ===\n");
24    let schema = schema_to_json(&registry);
25    for line in schema.lines().take(20) {
26        println!("{line}");
27    }
28    println!("...");
29
30    // Demonstrate instantiation
31    println!("\n=== Instantiation Test ===\n");
32    for name in registry.list() {
33        let node = registry.create(name);
34        println!("  {} → {}", name, if node.is_some() { "✓" } else { "✗" });
35    }
36}
Source

pub fn param_defs(&self, type_name: &str) -> Option<&[ParamDef]>

Get param defs for a node type.

Examples found in repository?
examples/registry_demo.rs (line 15)
8fn main() {
9    let registry = builtin_registry();
10
11    println!("=== AetherSDK Node Registry ===\n");
12    println!("Registered nodes: {}\n", registry.len());
13
14    for name in registry.list() {
15        let defs = registry.param_defs(name).unwrap_or(&[]);
16        println!("  {name}");
17        for d in defs {
18            println!("    • {:<16} [{:>7.1} – {:>7.1}]  default: {:.3}",
19                d.name, d.min, d.max, d.default);
20        }
21    }
22
23    println!("\n=== JSON Schema (first 20 lines) ===\n");
24    let schema = schema_to_json(&registry);
25    for line in schema.lines().take(20) {
26        println!("{line}");
27    }
28    println!("...");
29
30    // Demonstrate instantiation
31    println!("\n=== Instantiation Test ===\n");
32    for name in registry.list() {
33        let node = registry.create(name);
34        println!("  {} → {}", name, if node.is_some() { "✓" } else { "✗" });
35    }
36}
Source

pub fn len(&self) -> usize

Examples found in repository?
examples/registry_demo.rs (line 12)
8fn main() {
9    let registry = builtin_registry();
10
11    println!("=== AetherSDK Node Registry ===\n");
12    println!("Registered nodes: {}\n", registry.len());
13
14    for name in registry.list() {
15        let defs = registry.param_defs(name).unwrap_or(&[]);
16        println!("  {name}");
17        for d in defs {
18            println!("    • {:<16} [{:>7.1} – {:>7.1}]  default: {:.3}",
19                d.name, d.min, d.max, d.default);
20        }
21    }
22
23    println!("\n=== JSON Schema (first 20 lines) ===\n");
24    let schema = schema_to_json(&registry);
25    for line in schema.lines().take(20) {
26        println!("{line}");
27    }
28    println!("...");
29
30    // Demonstrate instantiation
31    println!("\n=== Instantiation Test ===\n");
32    for name in registry.list() {
33        let node = registry.create(name);
34        println!("  {} → {}", name, if node.is_some() { "✓" } else { "✗" });
35    }
36}
Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Default for NodeRegistry

Source§

fn default() -> Self

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

Auto Trait Implementations§

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.