[thin_check (rust)] factor out device detail

This commit is contained in:
Joe Thornber
2020-09-25 09:59:16 +01:00
parent 66b6a1ba48
commit a88ae3ca18
4 changed files with 58 additions and 33 deletions

View File

@@ -549,6 +549,8 @@ pub trait NodeVisitor<V: Unpack> {
keys: &[u64],
values: &[V],
) -> Result<()>;
fn end_walk(&self) -> Result<()>;
}
#[derive(Clone)]
@@ -758,6 +760,7 @@ impl BTreeWalker {
path.push(b.loc);
let r = self.walk_node_(path, visitor, kr, b, is_root);
path.pop();
visitor.end_walk()?;
r
}
@@ -843,8 +846,9 @@ where
V: Unpack,
{
path.push(b.loc);
let r = walk_node_threaded_(w, path, pool, visitor, kr, b, is_root);
let r = walk_node_threaded_(w, path, pool, visitor.clone(), kr, b, is_root);
path.pop();
visitor.end_walk()?;
r
}
@@ -992,6 +996,10 @@ impl<V: Unpack + Copy> NodeVisitor<V> for ValueCollector<V> {
Ok(())
}
fn end_walk(&self) -> Result<()> {
Ok(())
}
}
pub fn btree_to_map<V: Unpack + Copy>(
@@ -1051,6 +1059,10 @@ impl<V: Unpack + Clone> NodeVisitor<V> for ValuePathCollector<V> {
Ok(())
}
fn end_walk(&self) -> Result<()> {
Ok(())
}
}
pub fn btree_to_map_with_path<V: Unpack + Copy>(