pub(super) struct BalancingContext<'a, K, V> {
parent: Handle<NodeRef<Mut<'a>, K, V, Internal>, KV>,
left_child: NodeRef<Mut<'a>, K, V, LeafOrInternal>,
right_child: NodeRef<Mut<'a>, K, V, LeafOrInternal>,
}Expand description
Represents a session for evaluating and performing a balancing operation around an internal key-value pair.
Fields§
§parent: Handle<NodeRef<Mut<'a>, K, V, Internal>, KV>§left_child: NodeRef<Mut<'a>, K, V, LeafOrInternal>§right_child: NodeRef<Mut<'a>, K, V, LeafOrInternal>Implementations§
Source§impl<'a, K, V> BalancingContext<'a, K, V>
impl<'a, K, V> BalancingContext<'a, K, V>
pub(super) fn left_child_len(&self) -> usize
pub(super) fn right_child_len(&self) -> usize
pub(super) fn into_left_child(self) -> NodeRef<Mut<'a>, K, V, LeafOrInternal>
pub(super) fn into_right_child(self) -> NodeRef<Mut<'a>, K, V, LeafOrInternal>
Source§impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V>
impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V>
Sourcefn do_merge<F: FnOnce(NodeRef<Mut<'a>, K, V, Internal>, NodeRef<Mut<'a>, K, V, LeafOrInternal>) -> R, R, A: Allocator>(
self,
result: F,
alloc: A,
) -> R
fn do_merge<F: FnOnce(NodeRef<Mut<'a>, K, V, Internal>, NodeRef<Mut<'a>, K, V, LeafOrInternal>) -> R, R, A: Allocator>( self, result: F, alloc: A, ) -> R
Performs a merge and lets a closure decide what to return.
Sourcepub(super) fn merge_tracking_parent<A: AllocatorClone>(
self,
alloc: A,
) -> NodeRef<Mut<'a>, K, V, Internal>
pub(super) fn merge_tracking_parent<A: AllocatorClone>( self, alloc: A, ) -> NodeRef<Mut<'a>, K, V, Internal>
Merges the parent’s key-value pair and both adjacent child nodes into the left child node and returns the shrunk parent node.
Panics unless we .can_merge().
Sourcepub(super) fn merge_tracking_child<A: AllocatorClone>(
self,
alloc: A,
) -> NodeRef<Mut<'a>, K, V, LeafOrInternal>
pub(super) fn merge_tracking_child<A: AllocatorClone>( self, alloc: A, ) -> NodeRef<Mut<'a>, K, V, LeafOrInternal>
Merges the parent’s key-value pair and both adjacent child nodes into the left child node and returns that child node.
Panics unless we .can_merge().
Sourcepub(super) fn merge_tracking_child_edge<A: AllocatorClone>(
self,
track_edge_idx: LeftOrRight<usize>,
alloc: A,
) -> Handle<NodeRef<Mut<'a>, K, V, LeafOrInternal>, Edge>
pub(super) fn merge_tracking_child_edge<A: AllocatorClone>( self, track_edge_idx: LeftOrRight<usize>, alloc: A, ) -> Handle<NodeRef<Mut<'a>, K, V, LeafOrInternal>, Edge>
Merges the parent’s key-value pair and both adjacent child nodes into the left child node and returns the edge handle in that child node where the tracked child edge ended up,
Panics unless we .can_merge().
Sourcepub(super) fn steal_left(
self,
track_right_edge_idx: usize,
) -> Handle<NodeRef<Mut<'a>, K, V, LeafOrInternal>, Edge>
pub(super) fn steal_left( self, track_right_edge_idx: usize, ) -> Handle<NodeRef<Mut<'a>, K, V, LeafOrInternal>, Edge>
Removes a key-value pair from the left child and places it in the key-value storage
of the parent, while pushing the old parent key-value pair into the right child.
Returns a handle to the edge in the right child corresponding to where the original
edge specified by track_right_edge_idx ended up.
Sourcepub(super) fn steal_right(
self,
track_left_edge_idx: usize,
) -> Handle<NodeRef<Mut<'a>, K, V, LeafOrInternal>, Edge>
pub(super) fn steal_right( self, track_left_edge_idx: usize, ) -> Handle<NodeRef<Mut<'a>, K, V, LeafOrInternal>, Edge>
Removes a key-value pair from the right child and places it in the key-value storage
of the parent, while pushing the old parent key-value pair onto the left child.
Returns a handle to the edge in the left child specified by track_left_edge_idx,
which didn’t move.
Sourcepub(super) fn bulk_steal_left(&mut self, count: usize)
pub(super) fn bulk_steal_left(&mut self, count: usize)
This does stealing similar to steal_left but steals multiple elements at once.
Sourcepub(super) fn bulk_steal_right(&mut self, count: usize)
pub(super) fn bulk_steal_right(&mut self, count: usize)
The symmetric clone of bulk_steal_left.
Auto Trait Implementations§
impl<'a, K, V> !UnwindSafe for BalancingContext<'a, K, V>
impl<'a, K, V> Forget for BalancingContext<'a, K, V>
impl<'a, K, V> Freeze for BalancingContext<'a, K, V>where
*const LeafNode<K, V> is !null: Freeze,
PhantomData<(Mut<'a>, Internal)>: Freeze,
PhantomData<KV>: Freeze,
PhantomData<(Mut<'a>, LeafOrInternal)>: Freeze,
impl<'a, K, V> Move for BalancingContext<'a, K, V>
impl<'a, K, V> RefUnwindSafe for BalancingContext<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for BalancingContext<'a, K, V>
impl<'a, K, V> Sync for BalancingContext<'a, K, V>
impl<'a, K, V> Unpin for BalancingContext<'a, K, V>
impl<'a, K, V> UnsafeUnpin for BalancingContext<'a, K, V>where
*const LeafNode<K, V> is !null: UnsafeUnpin,
PhantomData<(Mut<'a>, Internal)>: UnsafeUnpin,
PhantomData<KV>: UnsafeUnpin,
PhantomData<(Mut<'a>, LeafOrInternal)>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize
#[doc(hidden)]const SIZE: usize
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize
#[doc(hidden)]const ALIGN: usize
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment
#[doc(hidden)]const ALIGNMENT: Alignment
sized_type_properties)Source§#[doc(hidden)]const IS_ZST: bool
#[doc(hidden)]const IS_ZST: bool
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout
#[doc(hidden)]const LAYOUT: Layout
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize
#[doc(hidden)]const MAX_SLICE_LEN: usize
sized_type_properties)[Self]. Read more