Skip to main content

DependencyGraph

Struct DependencyGraph 

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

Module dependency graph.

Implementations§

Source§

impl DependencyGraph

Source

pub fn new() -> Self

Creates a new empty dependency graph.

Source

pub fn add_module(&self, name: &str, dependencies: Vec<ModuleDependency>)

Adds a module to the graph.

Source

pub fn mark_loaded(&self, name: &str)

Marks a module as loaded.

Source

pub fn mark_unloaded(&self, name: &str)

Marks a module as unloaded.

Source

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

Checks if all dependencies of a module are satisfied.

Source

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).

Source

pub fn unload_order(&self) -> Result<Vec<String>>

Returns the unload order (reverse of load order).

Source

pub fn has_cycle(&self) -> bool

Detects circular dependencies.

Source

pub fn all_dependencies(&self, name: &str) -> HashSet<String>

Returns all dependencies (transitive) for a module.

Source

pub fn all_dependents(&self, name: &str) -> HashSet<String>

Returns all modules that depend on the given module (transitive).

Source

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

Checks if a module can be safely unloaded (no loaded dependents).

Source

pub fn module_count(&self) -> usize

Returns the number of registered modules.

Source

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

Returns all module names.

Source

pub fn get_module(&self, name: &str) -> Option<DependencyNode>

Returns information about a specific module.

Trait Implementations§

Source§

impl Debug for DependencyGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DependencyGraph

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.