Skip to main content

ModuleRegistry

Struct ModuleRegistry 

Source
pub struct ModuleRegistry { /* private fields */ }
Available on crate feature alloc only.
Expand description

Registry of available module types for instantiation

Implementations§

Source§

impl ModuleRegistry

Source

pub fn new() -> Self

Create a new empty registry

Source

pub fn register_factory<F>( &mut self, type_id: &str, name: &str, category: &str, description: &str, factory: F, )
where F: Fn(f64) -> Box<dyn GraphModule> + Send + Sync + 'static,

Register a module factory with metadata

Source

pub fn register_factory_with_keywords<F>( &mut self, type_id: &str, name: &str, category: &str, description: &str, keywords: &[&str], tags: &[&str], factory: F, )
where F: Fn(f64) -> Box<dyn GraphModule> + Send + Sync + 'static,

Register a module factory with metadata, keywords, and tags

Source

pub fn instantiate( &self, type_id: &str, sample_rate: f64, ) -> Option<Box<dyn GraphModule>>

Instantiate a module by type ID

Source

pub fn list_modules(&self) -> impl Iterator<Item = &ModuleMetadata>

List all registered module types

Source

pub fn get_metadata(&self, type_id: &str) -> Option<&ModuleMetadata>

Get metadata for a specific module type

Source

pub fn list_by_category<'a>( &'a self, category: &'a str, ) -> impl Iterator<Item = &'a ModuleMetadata>

List modules in a specific category

Source

pub fn categories(&self) -> Vec<String>

Get all unique categories

Source

pub fn catalog(&self) -> CatalogResponse

Get the full module catalog for the “add module” UI

Source

pub fn search(&self, query: &str) -> Vec<ModuleCatalogEntry>

Search modules by query string

Matches against type_id, name, description, and keywords (case-insensitive)

Source

pub fn by_category(&self, category: &str) -> Vec<ModuleCatalogEntry>

Get modules in a specific category

Trait Implementations§

Source§

impl Default for ModuleRegistry

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, 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.