redo into/create

redo-gragh
Avril 4 years ago
parent 0f263fd5ed
commit 8cbe975d50
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -162,39 +162,13 @@ impl HierarchicalINodeGraph
}); });
} }
} }
fn create_from(graph: &INodeInfoGraph) -> Self
{
let mut new = Self {
table: HashMap::with_capacity(graph.inodes.len()),
};
for (path, &inode) in graph.paths.iter() #[inline(always)] fn create(graph: INodeInfoGraph) -> Self
{ {
//Lookup the INode in graph inode table //eh...
if let Some(fsinfo) = graph.inodes.get(&inode) Self::create_from(&graph)
{
match fsinfo {
FsInfo::File(sz, parent) => {
new.table.insert(path.clone(), HierarchicalNode {
kind: NodeKind::File(*sz),
inode,
});
},
FsInfo::Directory(parent) => {
new.table.insert(path.clone(), HierarchicalNode {
kind: NodeKind::Directory(graph.children.get(&inode).unwrap().iter().map(|node| {
graph.paths_reverse.get(node).unwrap().clone()
}).collect(), None),
inode,
});
},
} }
} fn create_from(graph: &INodeInfoGraph) -> Self
}
new
}
fn create(graph: INodeInfoGraph) -> Self
{ {
let mut new = Self { let mut new = Self {
table: HashMap::with_capacity(graph.inodes.len()), table: HashMap::with_capacity(graph.inodes.len()),

Loading…
Cancel
Save