MCPcopy Index your code
hub / github.com/encounter/objdiff / build_nodes

Function build_nodes

objdiff-gui/src/config.rs:54–78  ·  view source on GitHub ↗
(units: &mut [ObjectConfig])

Source from the content-addressed store, hash-verified

52}
53
54fn build_nodes(units: &mut [ObjectConfig]) -> Vec<ProjectObjectNode> {
55 let mut nodes = vec![];
56 for (idx, unit) in units.iter_mut().enumerate() {
57 let mut out_nodes = &mut nodes;
58 let path = Utf8UnixPath::new(&unit.name);
59 if let Some(parent) = path.parent() {
60 for component in parent.components() {
61 if let Utf8UnixComponent::Normal(name) = component {
62 out_nodes = find_dir(name, out_nodes);
63 }
64 }
65 }
66 let filename = path.file_name().unwrap().to_string();
67 out_nodes.push(ProjectObjectNode::Unit(filename, idx));
68 }
69 // Within the top-level module directories, join paths. Leave the
70 // top-level name intact though since it's the module name.
71 for node in &mut nodes {
72 if let ProjectObjectNode::Dir(_, sub_nodes) = node {
73 join_single_dir_entries(sub_nodes);
74 }
75 }
76
77 nodes
78}
79
80pub fn load_project_config(state: &mut AppState) -> Result<()> {
81 let Some(project_dir) = &state.config.project_dir else {

Callers 1

load_project_configFunction · 0.85

Calls 4

find_dirFunction · 0.85
join_single_dir_entriesFunction · 0.85
iter_mutMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected