pub struct ModuleGraph {
pub modules: BTreeMap<ModuleId, ModuleInfo>,
pub edges: BTreeMap<ModuleId, BTreeSet<ModuleId>>,
pub entry: ModuleId,
}Expand description
A directed acyclic graph of module dependencies.
Uses BTreeMap internally for deterministic iteration order.
Fields§
§modules: BTreeMap<ModuleId, ModuleInfo>All modules in the graph, keyed by ModuleId.
edges: BTreeMap<ModuleId, BTreeSet<ModuleId>>Directed edges: module → set of modules it depends on.
entry: ModuleIdThe entry module ID.
Implementations§
Source§impl ModuleGraph
impl ModuleGraph
Sourcepub fn topological_order(&self) -> Result<Vec<ModuleId>, ModuleError>
pub fn topological_order(&self) -> Result<Vec<ModuleId>, ModuleError>
Return modules in deterministic topological order (dependencies first).
Returns Err if a cycle is detected.
Sourcepub fn module_count(&self) -> usize
pub fn module_count(&self) -> usize
Get the number of modules in the graph.
Trait Implementations§
Source§impl Clone for ModuleGraph
impl Clone for ModuleGraph
Source§fn clone(&self) -> ModuleGraph
fn clone(&self) -> ModuleGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ModuleGraph
impl RefUnwindSafe for ModuleGraph
impl Send for ModuleGraph
impl Sync for ModuleGraph
impl Unpin for ModuleGraph
impl UnsafeUnpin for ModuleGraph
impl UnwindSafe for ModuleGraph
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