From 154e6d1c53500eef6b8e74a9c3c87c137936f58f Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Tue, 11 May 2021 12:55:14 +0200 Subject: [PATCH] BTree: inline more functions supporting iteration --- library/alloc/src/collections/btree/navigate.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/alloc/src/collections/btree/navigate.rs b/library/alloc/src/collections/btree/navigate.rs index 563c070dd0f1f..8d6227195976f 100644 --- a/library/alloc/src/collections/btree/navigate.rs +++ b/library/alloc/src/collections/btree/navigate.rs @@ -250,6 +250,7 @@ impl Handle, marker::Edge> { /// - The returned KV handle is only valid to access the key and value, /// and only valid until the next call to this method or counterpart /// `deallocating_next_back`. + #[inline] pub unsafe fn deallocating_next( self, ) -> Option<(Self, Handle, marker::KV>)> @@ -280,6 +281,7 @@ impl Handle, marker::Edge> { /// - The returned KV handle is only valid to access the key and value, /// and only valid until the next call to this method or counterpart /// `deallocating_next`. + #[inline] unsafe fn deallocating_next_back( self, ) -> Option<(Self, Handle, marker::KV>)> @@ -316,6 +318,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::Ed /// /// # Safety /// There must be another KV in the direction travelled. + #[inline] pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) { super::mem::replace(self, |leaf_edge| { let kv = leaf_edge.next_kv(); @@ -329,6 +332,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::Ed /// /// # Safety /// There must be another KV in the direction travelled. + #[inline] pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a V) { super::mem::replace(self, |leaf_edge| { let kv = leaf_edge.next_back_kv(); @@ -344,6 +348,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::E /// /// # Safety /// There must be another KV in the direction travelled. + #[inline] pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a mut V) { let kv = super::mem::replace(self, |leaf_edge| { let kv = leaf_edge.next_kv(); @@ -359,6 +364,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::E /// /// # Safety /// There must be another KV in the direction travelled. + #[inline] pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a mut V) { let kv = super::mem::replace(self, |leaf_edge| { let kv = leaf_edge.next_back_kv(); @@ -383,6 +389,7 @@ impl Handle, marker::Edge> { /// /// The only safe way to proceed with the updated handle is to compare it, drop it, /// or call this method or counterpart `deallocating_next_back_unchecked` again. + #[inline] pub unsafe fn deallocating_next_unchecked( &mut self, ) -> Handle, marker::KV> { @@ -403,6 +410,7 @@ impl Handle, marker::Edge> { /// /// The only safe way to proceed with the updated handle is to compare it, drop it, /// or call this method or counterpart `deallocating_next_unchecked` again. + #[inline] pub unsafe fn deallocating_next_back_unchecked( &mut self, ) -> Handle, marker::KV> {