pub struct ModuleDependencyGraph { /* private fields */ }Expand description
A dependency graph between modules.
Allows topological ordering for deterministic import order.
Implementations§
Source§impl ModuleDependencyGraph
impl ModuleDependencyGraph
Sourcepub fn add_module(&mut self, name: String)
pub fn add_module(&mut self, name: String)
Add a module to the graph.
Sourcepub fn from_cache(cache: &ModuleCache) -> Self
pub fn from_cache(cache: &ModuleCache) -> Self
Build a dependency graph from a module cache.
Sourcepub fn topological_order(&self) -> Result<Vec<String>, String>
pub fn topological_order(&self) -> Result<Vec<String>, String>
Compute a topological ordering of modules (Kahn’s algorithm).
Returns Err if there is a cycle.
Sourcepub fn depends_on(&self, a: &str, b: &str) -> bool
pub fn depends_on(&self, a: &str, b: &str) -> bool
Check if module a depends (transitively) on module b.
Sourcepub fn num_modules(&self) -> usize
pub fn num_modules(&self) -> usize
Number of modules in the graph.
Trait Implementations§
Source§impl Debug for ModuleDependencyGraph
impl Debug for ModuleDependencyGraph
Source§impl Default for ModuleDependencyGraph
impl Default for ModuleDependencyGraph
Source§fn default() -> ModuleDependencyGraph
fn default() -> ModuleDependencyGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModuleDependencyGraph
impl RefUnwindSafe for ModuleDependencyGraph
impl Send for ModuleDependencyGraph
impl Sync for ModuleDependencyGraph
impl Unpin for ModuleDependencyGraph
impl UnsafeUnpin for ModuleDependencyGraph
impl UnwindSafe for ModuleDependencyGraph
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