ModuleRegistry

Struct ModuleRegistry 

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

Generic module registry

Thread-safe registry for storing and instantiating modules at runtime. Modules are registered with a factory function and can be created by name.

Implementations§

Source§

impl ModuleRegistry

Source

pub fn new() -> Self

Create a new empty registry

Source

pub fn global() -> &'static Self

Get the global registry instance

Source

pub fn register(&self, name: &str, module_type: &str, factory: ModuleFactory)

Register a module with a factory function

The factory function should return a Box cast to Box<dyn Any + Send + Sync>

Source

pub fn register_with_metadata( &self, name: &str, module_type: &str, instantiate_fn: &str, module_path: &str, struct_name: &str, factory: ModuleFactory, )

Register a module with full metadata

Source

pub fn create_any(&self, name: &str) -> Result<Box<dyn Any + Send + Sync>>

Create a module instance by name

Returns Box<dyn Any + Send + Sync> which you must downcast to your trait type

Source

pub fn create<T: 'static>(&self, name: &str) -> Result<Box<T>>

Create and downcast a module to a specific trait type

Source

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

Get all registered module names

Source

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

Get all registered module names (alias for compatibility)

Source

pub fn has_module(&self, name: &str) -> bool

Check if a module is registered

Source

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

Get metadata for a module

Source

pub fn clear(&self)

Clear all registered modules (for testing)

Source

pub fn count(&self) -> usize

Get count of registered modules

Source

pub fn verify_module_signature(&self, name: &str) -> Result<bool>

Verify module signature

Source

pub fn check_module_permissions( &self, name: &str, required_permission: &str, ) -> Result<bool>

Check if module has required permissions

Source

pub fn is_module_approved(&self, name: &str) -> Result<bool>

Check if module passed code review

Source

pub fn verify_supply_chain(&self, name: &str) -> Result<bool>

Verify supply chain information

Source

pub fn create_secure(&self, name: &str) -> Result<Box<dyn Any + Send + Sync>>

Create module with security checks

Source

pub fn create_with_sandbox( &self, name: &str, ) -> Result<Box<dyn Any + Send + Sync>>

Create module with sandbox configuration

Source

pub fn register_secure( &self, name: &str, module_type: &str, factory: ModuleFactory, signature: Option<ModuleSignature>, permissions: ModulePermissions, supply_chain: Option<SupplyChainInfo>, )

Register module with security metadata

Source

pub fn update_review_status( &self, name: &str, status: CodeReviewStatus, ) -> Result<()>

Update code review status

Source

pub fn get_security_report(&self) -> HashMap<String, SecurityReport>

Get security report for all modules

Source

pub fn security_audit(&self) -> HashMap<String, SecurityCheckResult>

Perform comprehensive security check on all modules

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.