pub struct Registry { /* private fields */ }Expand description
Maps node kinds (llm, if-else, …) to factories.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
Registry with every built-in core node.
Sourcepub fn register<F>(&mut self, kind: &str, factory: F) -> &mut Self
pub fn register<F>(&mut self, kind: &str, factory: F) -> &mut Self
Register (or replace) a factory for kind.
Sourcepub fn register_described<F>(
&mut self,
descriptor: NodeDescriptor,
factory: F,
) -> &mut Self
pub fn register_described<F>( &mut self, descriptor: NodeDescriptor, factory: F, ) -> &mut Self
Register (or replace) a factory together with its catalog descriptor.
The descriptor’s kind is the registered node type.
Sourcepub fn register_lazily_described<F>(
&mut self,
kind: &str,
descriptor: DescriptorFn,
factory: F,
) -> &mut Self
pub fn register_lazily_described<F>( &mut self, kind: &str, descriptor: DescriptorFn, factory: F, ) -> &mut Self
Register a factory whose catalog descriptor is built by descriptor the
first time it is requested. Use this for kinds registered on every start
(built-ins), so processes that never list the catalog skip building it.
The built descriptor’s kind must be kind.
Sourcepub fn describe(&mut self, descriptor: NodeDescriptor) -> &mut Self
pub fn describe(&mut self, descriptor: NodeDescriptor) -> &mut Self
Attach or replace the descriptor of an already-registered kind.
Sourcepub fn descriptor(&self, kind: &str) -> Option<NodeDescriptor>
pub fn descriptor(&self, kind: &str) -> Option<NodeDescriptor>
Descriptor of a kind. Kinds registered without one get a bare descriptor.
Sourcepub fn descriptor_ref(&self, kind: &str) -> Option<&NodeDescriptor>
pub fn descriptor_ref(&self, kind: &str) -> Option<&NodeDescriptor>
Borrowed descriptor of a kind registered with one (None for unknown
kinds and kinds registered without a descriptor). Builds a lazy
descriptor on first use.
Sourcepub fn descriptors(&self) -> Vec<NodeDescriptor>
pub fn descriptors(&self) -> Vec<NodeDescriptor>
Catalog of every registered kind, sorted by kind.
Sourcepub fn alias(&mut self, alias: &str, kind: &str) -> &mut Self
pub fn alias(&mut self, alias: &str, kind: &str) -> &mut Self
Register an alias resolving to an already-registered kind.