removed tree::find_key/find_key_rev in favour of entry/_rev
This commit is contained in:
parent
db762e0187
commit
6762812ec5
|
@ -339,26 +339,6 @@ impl<R: super::Read> Tree<R> {
|
|||
Ok(entry)
|
||||
}
|
||||
|
||||
pub fn find_key<K>(&self, key: &K) -> Result<Option<(Item, TreeItem)>>
|
||||
where
|
||||
K: PartialEq<Key> + PartialOrd<Key>,
|
||||
{
|
||||
match self.find_node(key)? {
|
||||
Some(node) => node.parse_item().map(|item| Some(item)),
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_key_rev<K>(&self, key: &K) -> Result<Option<(Item, TreeItem)>>
|
||||
where
|
||||
K: PartialEq<Key> + PartialOrd<Key>,
|
||||
{
|
||||
match self.find_node_rev(key)? {
|
||||
Some(node) => node.parse_item().map(|item| Some(item)),
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_range<K>(&self, key: &K) -> Result<Range<R>>
|
||||
where
|
||||
K: PartialEq<Key> + PartialOrd<Key>,
|
||||
|
|
|
@ -322,14 +322,15 @@ impl<R: super::Read> Volume2<R> {
|
|||
0x8dbfc2d2, // crc of "default"
|
||||
);
|
||||
|
||||
let subvol_root = root_tree
|
||||
.find_key(&key)?
|
||||
.ok_or(Error::NoDefaultSubvolRoot)?;
|
||||
let subvol_root = match root_tree.entry(&key)? {
|
||||
super::tree::entry::Entry::Occupied(entry) => Some(entry.value()?),
|
||||
super::tree::entry::Entry::Vacant(_) => None,
|
||||
}
|
||||
.ok_or(Error::NoDefaultSubvolRoot)?;
|
||||
// if we found the dir entry of the "default subvol" (mharmstone nomenclature)
|
||||
// we then look for the root fs tree in the root tree with the ID found in the `.location` of the dir_item only (from mharmstone)
|
||||
|
||||
let subvol_id = subvol_root
|
||||
.1
|
||||
.as_dir_item()
|
||||
.expect("dir item")
|
||||
.first()
|
||||
|
|
Loading…
Reference in a new issue