pub struct DependencyGraph { /* private fields */ }Expand description
Directed acyclic graph of crate dependencies.
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn add_edge(&mut self, from: &str, depends_on: &str)
pub fn add_edge(&mut self, from: &str, depends_on: &str)
Add a directed edge from → depends_on.
Sourcepub fn dependencies_of(&self, node: &str) -> Vec<&str>
pub fn dependencies_of(&self, node: &str) -> Vec<&str>
Direct dependencies of node.
Sourcepub fn dependents_of(&self, node: &str) -> Vec<&str>
pub fn dependents_of(&self, node: &str) -> Vec<&str>
Reverse lookup: who depends on node.
Sourcepub fn topological_sort(&self) -> Result<Vec<String>, DiscoveryError>
pub fn topological_sort(&self) -> Result<Vec<String>, DiscoveryError>
Topological sort. Returns Err with a cycle on failure.
Sourcepub fn transitive_deps(&self, node: &str) -> HashSet<String>
pub fn transitive_deps(&self, node: &str) -> HashSet<String>
Transitive closure of dependencies for node.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DependencyGraph
impl Debug for DependencyGraph
Source§impl Default for DependencyGraph
impl Default for DependencyGraph
Source§fn default() -> DependencyGraph
fn default() -> DependencyGraph
Returns the “default value” for a type. Read more
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