DependencyGraph

Struct DependencyGraph 

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

Represents a directed graph of project dependencies

Implementations§

Source§

impl DependencyGraph

Source

pub fn new(allow_cycles: bool) -> Self

Creates a new dependency graph

Source

pub fn add_project(&mut self, project: Project) -> Result<()>

Adds a project to the graph

Source

pub fn add_dependency(&mut self, dependency: ProjectDependency) -> Result<()>

Adds a dependency to the graph

Source

pub fn remove_dependency(&mut self, from: &str, to: &str) -> Result<()>

Removes a dependency from the graph

Source

pub fn can_reach(&self, from: &str, to: &str) -> bool

Checks if one project can reach another through the dependency graph

Source

pub fn get_dependencies(&self, project: &str) -> Vec<String>

Gets all direct dependencies of a project

Source

pub fn get_dependents(&self, project: &str) -> Vec<String>

Gets all projects that depend on a given project

Source

pub fn get_transitive_dependencies(&self, project: &str) -> Vec<String>

Gets all transitive dependencies of a project

Source

pub fn validate(&self) -> Result<()>

Validates the graph consistency

Source

pub fn detect_cycles(&self) -> Result<()>

Detects cycles in the graph

Source

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

Gets the topological order of projects

Source

pub fn get_projects(&self) -> Vec<Project>

Gets all projects in the graph

Source

pub fn get_all_dependencies(&self) -> Vec<ProjectDependency>

Gets all dependencies in the graph

Source

pub fn project_count(&self) -> usize

Gets the number of projects

Source

pub fn dependency_count(&self) -> usize

Gets the number of dependencies

Source

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

Checks if a project exists in the graph

Source

pub fn has_dependency(&self, from: &str, to: &str) -> bool

Checks if a dependency exists in the graph

Source

pub fn get_adjacency_list(&self) -> HashMap<String, Vec<String>>

Gets the adjacency list representation

Source

pub fn get_reverse_adjacency_list(&self) -> HashMap<String, Vec<String>>

Gets the reverse adjacency list representation

Source

pub fn clear(&mut self)

Clears the graph

Trait Implementations§

Source§

impl Clone for DependencyGraph

Source§

fn clone(&self) -> DependencyGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more