pub struct DependencyGraph { /* private fields */ }Expand description
Module dependency graph.
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn add_module(&self, name: &str, dependencies: Vec<ModuleDependency>)
pub fn add_module(&self, name: &str, dependencies: Vec<ModuleDependency>)
Adds a module to the graph.
Sourcepub fn mark_loaded(&self, name: &str)
pub fn mark_loaded(&self, name: &str)
Marks a module as loaded.
Sourcepub fn mark_unloaded(&self, name: &str)
pub fn mark_unloaded(&self, name: &str)
Marks a module as unloaded.
Sourcepub fn dependencies_satisfied(&self, name: &str) -> bool
pub fn dependencies_satisfied(&self, name: &str) -> bool
Checks if all dependencies of a module are satisfied.
Sourcepub fn load_order(&self) -> Result<Vec<String>>
pub fn load_order(&self) -> Result<Vec<String>>
Returns the load order for all modules (topological sort).
Returns modules in order they should be loaded (dependencies first).
Sourcepub fn unload_order(&self) -> Result<Vec<String>>
pub fn unload_order(&self) -> Result<Vec<String>>
Returns the unload order (reverse of load order).
Sourcepub fn all_dependencies(&self, name: &str) -> HashSet<String>
pub fn all_dependencies(&self, name: &str) -> HashSet<String>
Returns all dependencies (transitive) for a module.
Sourcepub fn all_dependents(&self, name: &str) -> HashSet<String>
pub fn all_dependents(&self, name: &str) -> HashSet<String>
Returns all modules that depend on the given module (transitive).
Sourcepub fn can_unload(&self, name: &str) -> bool
pub fn can_unload(&self, name: &str) -> bool
Checks if a module can be safely unloaded (no loaded dependents).
Sourcepub fn module_count(&self) -> usize
pub fn module_count(&self) -> usize
Returns the number of registered modules.
Sourcepub fn all_modules(&self) -> Vec<String>
pub fn all_modules(&self) -> Vec<String>
Returns all module names.
Sourcepub fn get_module(&self, name: &str) -> Option<DependencyNode>
pub fn get_module(&self, name: &str) -> Option<DependencyNode>
Returns information about a specific module.
Trait Implementations§
Source§impl Debug for DependencyGraph
impl Debug for DependencyGraph
Auto Trait Implementations§
impl Freeze for DependencyGraph
impl !RefUnwindSafe for DependencyGraph
impl Send for DependencyGraph
impl Sync for DependencyGraph
impl Unpin for DependencyGraph
impl UnsafeUnpin for DependencyGraph
impl UnwindSafe for DependencyGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more