pub struct DependencyGraph { /* private fields */ }Expand description
Represents a directed graph of project dependencies
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn add_project(&mut self, project: Project) -> Result<()>
pub fn add_project(&mut self, project: Project) -> Result<()>
Adds a project to the graph
Sourcepub fn add_dependency(&mut self, dependency: ProjectDependency) -> Result<()>
pub fn add_dependency(&mut self, dependency: ProjectDependency) -> Result<()>
Adds a dependency to the graph
Sourcepub fn remove_dependency(&mut self, from: &str, to: &str) -> Result<()>
pub fn remove_dependency(&mut self, from: &str, to: &str) -> Result<()>
Removes a dependency from the graph
Sourcepub fn can_reach(&self, from: &str, to: &str) -> bool
pub fn can_reach(&self, from: &str, to: &str) -> bool
Checks if one project can reach another through the dependency graph
Sourcepub fn get_dependencies(&self, project: &str) -> Vec<String>
pub fn get_dependencies(&self, project: &str) -> Vec<String>
Gets all direct dependencies of a project
Sourcepub fn get_dependents(&self, project: &str) -> Vec<String>
pub fn get_dependents(&self, project: &str) -> Vec<String>
Gets all projects that depend on a given project
Sourcepub fn get_transitive_dependencies(&self, project: &str) -> Vec<String>
pub fn get_transitive_dependencies(&self, project: &str) -> Vec<String>
Gets all transitive dependencies of a project
Sourcepub fn detect_cycles(&self) -> Result<()>
pub fn detect_cycles(&self) -> Result<()>
Detects cycles in the graph
Sourcepub fn topological_sort(&self) -> Result<Vec<String>>
pub fn topological_sort(&self) -> Result<Vec<String>>
Gets the topological order of projects
Sourcepub fn get_projects(&self) -> Vec<Project>
pub fn get_projects(&self) -> Vec<Project>
Gets all projects in the graph
Sourcepub fn get_all_dependencies(&self) -> Vec<ProjectDependency>
pub fn get_all_dependencies(&self) -> Vec<ProjectDependency>
Gets all dependencies in the graph
Sourcepub fn project_count(&self) -> usize
pub fn project_count(&self) -> usize
Gets the number of projects
Sourcepub fn dependency_count(&self) -> usize
pub fn dependency_count(&self) -> usize
Gets the number of dependencies
Sourcepub fn has_project(&self, name: &str) -> bool
pub fn has_project(&self, name: &str) -> bool
Checks if a project exists in the graph
Sourcepub fn has_dependency(&self, from: &str, to: &str) -> bool
pub fn has_dependency(&self, from: &str, to: &str) -> bool
Checks if a dependency exists in the graph
Sourcepub fn get_adjacency_list(&self) -> HashMap<String, Vec<String>>
pub fn get_adjacency_list(&self) -> HashMap<String, Vec<String>>
Gets the adjacency list representation
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 moreSource§impl Debug for DependencyGraph
impl Debug for DependencyGraph
Auto Trait Implementations§
impl Freeze for DependencyGraph
impl RefUnwindSafe for DependencyGraph
impl Send for DependencyGraph
impl Sync for DependencyGraph
impl Unpin 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