Skip to content

Commit 154e6d1

Browse files
committed
BTree: inline more functions supporting iteration
1 parent 9f6717c commit 154e6d1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/alloc/src/collections/btree/navigate.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ impl<K, V> Handle<NodeRef<marker::Dying, K, V, marker::Leaf>, marker::Edge> {
250250
/// - The returned KV handle is only valid to access the key and value,
251251
/// and only valid until the next call to this method or counterpart
252252
/// `deallocating_next_back`.
253+
#[inline]
253254
pub unsafe fn deallocating_next(
254255
self,
255256
) -> Option<(Self, Handle<NodeRef<marker::Dying, K, V, marker::LeafOrInternal>, marker::KV>)>
@@ -280,6 +281,7 @@ impl<K, V> Handle<NodeRef<marker::Dying, K, V, marker::Leaf>, marker::Edge> {
280281
/// - The returned KV handle is only valid to access the key and value,
281282
/// and only valid until the next call to this method or counterpart
282283
/// `deallocating_next`.
284+
#[inline]
283285
unsafe fn deallocating_next_back(
284286
self,
285287
) -> Option<(Self, Handle<NodeRef<marker::Dying, K, V, marker::LeafOrInternal>, marker::KV>)>
@@ -316,6 +318,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Ed
316318
///
317319
/// # Safety
318320
/// There must be another KV in the direction travelled.
321+
#[inline]
319322
pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) {
320323
super::mem::replace(self, |leaf_edge| {
321324
let kv = leaf_edge.next_kv();
@@ -329,6 +332,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Immut<'a>, K, V, marker::Leaf>, marker::Ed
329332
///
330333
/// # Safety
331334
/// There must be another KV in the direction travelled.
335+
#[inline]
332336
pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a V) {
333337
super::mem::replace(self, |leaf_edge| {
334338
let kv = leaf_edge.next_back_kv();
@@ -344,6 +348,7 @@ impl<'a, K, V> Handle<NodeRef<marker::ValMut<'a>, K, V, marker::Leaf>, marker::E
344348
///
345349
/// # Safety
346350
/// There must be another KV in the direction travelled.
351+
#[inline]
347352
pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a mut V) {
348353
let kv = super::mem::replace(self, |leaf_edge| {
349354
let kv = leaf_edge.next_kv();
@@ -359,6 +364,7 @@ impl<'a, K, V> Handle<NodeRef<marker::ValMut<'a>, K, V, marker::Leaf>, marker::E
359364
///
360365
/// # Safety
361366
/// There must be another KV in the direction travelled.
367+
#[inline]
362368
pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a mut V) {
363369
let kv = super::mem::replace(self, |leaf_edge| {
364370
let kv = leaf_edge.next_back_kv();
@@ -383,6 +389,7 @@ impl<K, V> Handle<NodeRef<marker::Dying, K, V, marker::Leaf>, marker::Edge> {
383389
///
384390
/// The only safe way to proceed with the updated handle is to compare it, drop it,
385391
/// or call this method or counterpart `deallocating_next_back_unchecked` again.
392+
#[inline]
386393
pub unsafe fn deallocating_next_unchecked(
387394
&mut self,
388395
) -> Handle<NodeRef<marker::Dying, K, V, marker::LeafOrInternal>, marker::KV> {
@@ -403,6 +410,7 @@ impl<K, V> Handle<NodeRef<marker::Dying, K, V, marker::Leaf>, marker::Edge> {
403410
///
404411
/// The only safe way to proceed with the updated handle is to compare it, drop it,
405412
/// or call this method or counterpart `deallocating_next_unchecked` again.
413+
#[inline]
406414
pub unsafe fn deallocating_next_back_unchecked(
407415
&mut self,
408416
) -> Handle<NodeRef<marker::Dying, K, V, marker::LeafOrInternal>, marker::KV> {

0 commit comments

Comments
 (0)