redo into/create

redo-gragh
Avril 3 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()
{
//Lookup the INode in graph inode table
if let Some(fsinfo) = graph.inodes.get(&inode)
{
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,
});
},
}
}
}
new
#[inline(always)] fn create(graph: INodeInfoGraph) -> Self
{
//eh...
Self::create_from(&graph)
}
fn create(graph: INodeInfoGraph) -> Self
fn create_from(graph: &INodeInfoGraph) -> Self
{
let mut new = Self {
table: HashMap::with_capacity(graph.inodes.len()),

Loading…
Cancel
Save