diff --git a/src/tree/entry_ref.rs b/src/tree/entry_ref.rs index e76f18a..7de5d3c 100644 --- a/src/tree/entry_ref.rs +++ b/src/tree/entry_ref.rs @@ -93,7 +93,7 @@ pub struct EntryRefDetached { impl EntryRefDetached { /// This is a hack to get around the borrow checker - pub fn to_ref(self, tree: TR) -> EntryRef { + pub fn into_ref(self, tree: TR) -> EntryRef { EntryRef:: { inner_stack: self.inner_stack, leaf_id: self.leaf_id, @@ -121,7 +121,7 @@ impl EntryRef { } } - pub fn to_detached(self) -> EntryRefDetached { + pub fn into_detached(self) -> EntryRefDetached { EntryRefDetached { inner_stack: self.inner_stack, leaf_id: self.leaf_id, diff --git a/src/tree/mod.rs b/src/tree/mod.rs index 3d86f14..81f6e89 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs @@ -697,7 +697,9 @@ where S::Argument: SearchArgument, { let entry_ref = self.get_ref_by_argument(query)?; - Some(Self::get_mut_by_ref(entry_ref.to_detached().to_ref(self))) + Some(Self::get_mut_by_ref( + entry_ref.into_detached().into_ref(self), + )) } /// Get rank for argument @@ -732,7 +734,7 @@ where S::Argument: SearchArgument, { let entry_ref = self.get_ref_by_argument(query)?; - Self::remove_by_ref(entry_ref.to_detached().to_ref(self)) + Self::remove_by_ref(entry_ref.into_detached().into_ref(self)) } /// Get the (&K, &V) pair for referece @@ -967,7 +969,6 @@ mod tests { for i in keys { let k = i; - println!("\ndeleting {i}"); let delete_result = tree.remove(&k); assert!(delete_result.is_some()); diff --git a/src/tree/tree_remove.rs b/src/tree/tree_remove.rs index fdf32fb..f60c69f 100644 --- a/src/tree/tree_remove.rs +++ b/src/tree/tree_remove.rs @@ -11,7 +11,7 @@ impl BPlusTree { S::K: Borrow, { let entry_ref = self.key_to_ref(k)?; - let entry_ref_mut: EntryRef<&mut Self> = entry_ref.to_detached().to_ref(self); + let entry_ref_mut: EntryRef<&mut Self> = entry_ref.into_detached().into_ref(self); Self::remove_by_ref(entry_ref_mut) }