pub struct DependencyGraph {
pub depends_on: HashMap<String, HashSet<String>>,
pub depended_by: HashMap<String, HashSet<String>>,
}Expand description
Dependency graph built from artifact dependencies.
Fields§
§depends_on: HashMap<String, HashSet<String>>Adjacency list: artifact URI -> set of artifacts it depends on.
depended_by: HashMap<String, HashSet<String>>Reverse adjacency list: artifact URI -> set of artifacts that depend on it.
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn from_artifacts(artifacts: &[Artifact]) -> Self
pub fn from_artifacts(artifacts: &[Artifact]) -> Self
Build a dependency graph from a list of artifacts.
Sourcepub fn get_dependents(&self, uri: &str) -> Vec<String>
pub fn get_dependents(&self, uri: &str) -> Vec<String>
Get all artifacts that directly depend on the given artifact.
Sourcepub fn get_dependencies(&self, uri: &str) -> Vec<String>
pub fn get_dependencies(&self, uri: &str) -> Vec<String>
Get all artifacts that the given artifact directly depends on.
Sourcepub fn detect_cycles(&self) -> Vec<Vec<String>>
pub fn detect_cycles(&self) -> Vec<Vec<String>>
Detect cycles in the dependency graph using DFS.
Sourcepub fn detect_self_dependencies(&self) -> Vec<String>
pub fn detect_self_dependencies(&self) -> Vec<String>
Check for self-dependencies (artifact depends on itself).
Trait Implementations§
Source§impl Clone for DependencyGraph
impl Clone for DependencyGraph
Source§fn clone(&self) -> DependencyGraph
fn clone(&self) -> DependencyGraph
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 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