pub struct ModuleRegistry { /* private fields */ }Expand description
Module registry for managing multiple modules.
Implementations§
Source§impl ModuleRegistry
impl ModuleRegistry
Sourcepub fn all_modules(&self) -> Vec<&Module>
pub fn all_modules(&self) -> Vec<&Module>
Get all registered modules.
Sourcepub fn get_mut(&mut self, path: &str) -> Option<&mut Module>
pub fn get_mut(&mut self, path: &str) -> Option<&mut Module>
Get a mutable reference to a module by path.
Sourcepub fn unregister(&mut self, path: &str) -> Option<Module>
pub fn unregister(&mut self, path: &str) -> Option<Module>
Remove and return a module from the registry.
Sourcepub fn resolve(&self, from: &str, name: &str) -> ResolvedName
pub fn resolve(&self, from: &str, name: &str) -> ResolvedName
Resolve a name from the perspective of a given module.
Checks the module’s local declarations first, then searches through its imports using import specifications.
Sourcepub fn dependency_order(&self) -> Result<Vec<String>, Vec<String>>
pub fn dependency_order(&self) -> Result<Vec<String>, Vec<String>>
Compute a topological sort of modules based on their dependencies.
Returns Ok(order) with module names in dependency order (dependencies first),
or Err(cycle) with the names of modules involved in a cycle.
Sourcepub fn detect_cycles(&self) -> Vec<Vec<String>>
pub fn detect_cycles(&self) -> Vec<Vec<String>>
Detect cycles in the module dependency graph.
Returns a list of cycles, where each cycle is a list of module names.
Sourcepub fn transitive_deps(&self, module: &str) -> Vec<String>
pub fn transitive_deps(&self, module: &str) -> Vec<String>
Get all transitive dependencies of a module.
Sourcepub fn detect_mutual_imports(&self) -> Vec<(String, String)>
pub fn detect_mutual_imports(&self) -> Vec<(String, String)>
Detect mutual (cyclic) imports between modules.
Sourcepub fn are_mutually_dependent(&self, a: &str, b: &str) -> bool
pub fn are_mutually_dependent(&self, a: &str, b: &str) -> bool
Check if two modules import each other.
Sourcepub fn get_dependents(&self, module_name: &str) -> Vec<String>
pub fn get_dependents(&self, module_name: &str) -> Vec<String>
Get all modules that depend on a given module.
Sourcepub fn get_all_dependencies(&self, module_name: &str) -> Vec<String>
pub fn get_all_dependencies(&self, module_name: &str) -> Vec<String>
Get all modules that a given module depends on (indirect + direct).
Sourcepub fn verify_consistency(&self) -> Result<(), Vec<String>>
pub fn verify_consistency(&self) -> Result<(), Vec<String>>
Verify module consistency (no broken imports).
Sourcepub fn get_reverse_dependencies(&self, module_name: &str) -> Vec<String>
pub fn get_reverse_dependencies(&self, module_name: &str) -> Vec<String>
Get all modules that would be transitively affected by changes to a module.
Sourcepub fn reachable_from(&self, module_name: &str) -> Vec<String>
pub fn reachable_from(&self, module_name: &str) -> Vec<String>
Reachability analysis: which modules can be reached from a given module.
Sourcepub fn get_sccs(&self) -> Vec<Vec<String>>
pub fn get_sccs(&self) -> Vec<Vec<String>>
Get module strongly connected components (for circular dependency analysis).
Sourcepub fn get_statistics(&self) -> HashMap<String, usize>
pub fn get_statistics(&self) -> HashMap<String, usize>
Get import statistics for debugging.
Sourcepub fn get_public_interface(&self, module_name: &str) -> Vec<String>
pub fn get_public_interface(&self, module_name: &str) -> Vec<String>
Export a module’s public interface.