From 8cbe975d5085ec46409e4510c20793a7576ff6a4 Mon Sep 17 00:00:00 2001 From: Avril Date: Mon, 15 Feb 2021 15:08:54 +0000 Subject: [PATCH] redo into/create --- src/data/graph.rs | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/src/data/graph.rs b/src/data/graph.rs index c15d5c9..a9e9847 100644 --- a/src/data/graph.rs +++ b/src/data/graph.rs @@ -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()),