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
impl TypeDependencyGraph
pub fn new() -> Self
Sourcepub fn add_type_definition(&mut self, type_name: String, file_path: PathBuf)
pub fn add_type_definition(&mut self, type_name: String, file_path: PathBuf)
Add a type definition to the graph
Sourcepub fn add_dependency(&mut self, dependent: String, dependency: String)
pub fn add_dependency(&mut self, dependent: String, dependency: String)
Add a dependency relationship between types
Sourcepub fn add_dependencies(
&mut self,
dependent: String,
dependencies: HashSet<String>,
)
pub fn add_dependencies( &mut self, dependent: String, dependencies: HashSet<String>, )
Add multiple dependencies for a type
Sourcepub fn add_resolved_type(&mut self, type_name: String, struct_info: StructInfo)
pub fn add_resolved_type(&mut self, type_name: String, struct_info: StructInfo)
Add a resolved type to the graph
Sourcepub fn get_resolved_types(&self) -> &HashMap<String, StructInfo>
pub fn get_resolved_types(&self) -> &HashMap<String, StructInfo>
Get all resolved types
Sourcepub fn get_dependencies(&self, type_name: &str) -> Option<&HashSet<String>>
pub fn get_dependencies(&self, type_name: &str) -> Option<&HashSet<String>>
Get dependencies for a type
Sourcepub fn has_type_definition(&self, type_name: &str) -> bool
pub fn has_type_definition(&self, type_name: &str) -> bool
Check if a type is defined in the graph
Sourcepub fn get_type_definition_path(&self, type_name: &str) -> Option<&PathBuf>
pub fn get_type_definition_path(&self, type_name: &str) -> Option<&PathBuf>
Get the file path where a type is defined
Sourcepub fn topological_sort_types(&self, types: &HashSet<String>) -> Vec<String>
pub fn topological_sort_types(&self, types: &HashSet<String>) -> Vec<String>
Perform topological sort on the given types using the dependency graph
Sourcepub fn visualize_dependencies(&self, entry_commands: &[CommandInfo]) -> String
pub fn visualize_dependencies(&self, entry_commands: &[CommandInfo]) -> String
Build visualization of the dependency graph
Sourcepub fn generate_dot_graph(&self, commands: &[CommandInfo]) -> String
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
impl Debug for TypeDependencyGraph
Source§impl Default for TypeDependencyGraph
impl Default for TypeDependencyGraph
Source§fn default() -> TypeDependencyGraph
fn default() -> TypeDependencyGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TypeDependencyGraph
impl RefUnwindSafe for TypeDependencyGraph
impl Send for TypeDependencyGraph
impl Sync for TypeDependencyGraph
impl Unpin for TypeDependencyGraph
impl UnwindSafe for TypeDependencyGraph
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