⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

DependencyGraph

Struct DependencyGraph 

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

A directed dependency graph for packages.

Nodes are package names; edges point from a package to its dependencies. Supports reverse dependency lookup, circular dependency detection, and dependency depth calculation.

Implementations§

Source§

impl DependencyGraph

Source

pub fn new() -> Self

Create a new empty dependency graph.

Source

pub fn add_package(&mut self, name: &str)

Add a package node to the graph (with no dependencies initially).

Source

pub fn add_dependency(&mut self, package: &str, dependency: &str)

Add a dependency edge: package depends on dependency.

Both nodes are created if they do not already exist.

Source

pub fn find_reverse_deps(&self, package: &str) -> Vec<String>

Find all packages that depend on the given package (reverse dependencies).

Source

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

Detect circular dependencies in the graph via DFS.

Returns a list of cycles, where each cycle is a list of package names forming the cycle. An empty result means no cycles exist.

Source

pub fn dependency_depth(&self, package: &str) -> usize

Compute the dependency depth of a package.

The depth is the longest path from any root (a package with no reverse dependencies) to this package. Returns 0 if the package is a root or is not in the graph.

Source

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

Find root nodes (packages that no other package depends on).

Source

pub fn package_count(&self) -> usize

Return the total number of packages in the graph.

Source

pub fn edge_count(&self) -> usize

Return the total number of dependency edges.

Source

pub fn dependencies(&self, package: &str) -> Option<&[String]>

Return the direct dependencies of a package.

Trait Implementations§

Source§

impl Default for DependencyGraph

Available on crate feature alloc only.
Source§

fn default() -> Self

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 UnwindSafe for DependencyGraph

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.