Skip to content

Commit

Permalink
use new cell iterator api
Browse files Browse the repository at this point in the history
  • Loading branch information
janstarke committed Apr 15, 2024
1 parent cd7ae19 commit 2274684
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ strum = { version = "0", features = ["derive"], optional=true }
strum_macros = {version="0", optional=true}

# nt-hive2
nt_hive2 = {version="4.1.0", optional=true}
#nt_hive2 = {version="4.1.0", optional=true}
nt_hive2 = {path="../nt-hive2", optional=true}

# lnk2bodyfile
lnk = {version="0.5.1", optional=true}
Expand Down
9 changes: 4 additions & 5 deletions src/bin/hivescan/regtreebuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,24 @@ impl RegTreeBuilder {
B: BinReaderExt,
C: Fn(u64),
{
let iterator = hive.into_cell_iterator(progress_callback);
let mut me = Self {
subtrees: HashMap::new(),
entries: HashMap::new(),
missing_parents: HashMap::new(),
};

let mut last_offset = Offset(0);
for cell in iterator {
for cell in hive.hivebins().flat_map(|hivebin| hivebin.cells()) {
let my_offset = *cell.offset();
let is_deleted = cell.header().is_deleted();
assert_ne!(last_offset, my_offset);
log::trace!("found new cell at offset 0x{:x}", my_offset.0);

if let Ok(nk) = TryInto::<KeyNode>::try_into(cell) {
me.insert_nk(my_offset, nk, is_deleted)
};

me.insert_nk(my_offset, nk, is_deleted);
}
last_offset = my_offset;
progress_callback(last_offset.0.into());
}
me
}
Expand Down

0 comments on commit 2274684

Please sign in to comment.