TypeDependencyGraph

Struct TypeDependencyGraph 

Source
pub struct TypeDependencyGraph {
    pub type_definitions: HashMap<String, PathBuf>,
    pub dependencies: HashMap<String, HashSet<String>>,
    pub resolved_types: HashMap<String, StructInfo>,
}
Expand description

Dependency graph for lazy type resolution

Fields§

§type_definitions: HashMap<String, PathBuf>

Maps type name to the files where it’s defined

§dependencies: HashMap<String, HashSet<String>>

Maps type name to types it depends on

§resolved_types: HashMap<String, StructInfo>

Maps type name to its resolved StructInfo

Implementations§

Source§

impl TypeDependencyGraph

Source

pub fn new() -> Self

Source

pub fn add_type_definition(&mut self, type_name: String, file_path: PathBuf)

Add a type definition to the graph

Source

pub fn add_dependency(&mut self, dependent: String, dependency: String)

Add a dependency relationship between types

Source

pub fn add_dependencies( &mut self, dependent: String, dependencies: HashSet<String>, )

Add multiple dependencies for a type

Source

pub fn add_resolved_type(&mut self, type_name: String, struct_info: StructInfo)

Add a resolved type to the graph

Source

pub fn get_resolved_types(&self) -> &HashMap<String, StructInfo>

Get all resolved types

Source

pub fn get_dependencies(&self, type_name: &str) -> Option<&HashSet<String>>

Get dependencies for a type

Source

pub fn has_type_definition(&self, type_name: &str) -> bool

Check if a type is defined in the graph

Source

pub fn get_type_definition_path(&self, type_name: &str) -> Option<&PathBuf>

Get the file path where a type is defined

Source

pub fn topological_sort_types(&self, types: &HashSet<String>) -> Vec<String>

Perform topological sort on the given types using the dependency graph

Source

pub fn visualize_dependencies(&self, entry_commands: &[CommandInfo]) -> String

Build visualization of the dependency graph

Source

pub fn generate_dot_graph(&self, commands: &[CommandInfo]) -> String

Generate a DOT graph representation of the dependency graph

Trait Implementations§

Source§

impl Debug for TypeDependencyGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TypeDependencyGraph

Source§

fn default() -> TypeDependencyGraph

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.