pub struct InternalNode<K, V>{
pub id: NodeId,
pub keys: Vec<K>,
pub children: Vec<NodeId>,
/* private fields */
}Expand description
Internal node (keys + child pointers)
Fields§
§id: NodeIdNode ID
keys: Vec<K>Keys (separator keys)
children: Vec<NodeId>Child node IDs (len = keys.len() + 1)
Implementations§
Source§impl<K, V> InternalNode<K, V>
impl<K, V> InternalNode<K, V>
Sourcepub fn with_child(child_id: NodeId) -> Self
pub fn with_child(child_id: NodeId) -> Self
Create with initial child
Sourcepub fn find_child_index(&self, key: &K) -> usize
pub fn find_child_index(&self, key: &K) -> usize
Find child index for key
Sourcepub fn insert_at(&mut self, idx: usize, key: K, right_child: NodeId)
pub fn insert_at(&mut self, idx: usize, key: K, right_child: NodeId)
Insert key and child at position
Sourcepub fn borrow_from_left(&mut self, left: &mut Self, parent_key: &K) -> K
pub fn borrow_from_left(&mut self, left: &mut Self, parent_key: &K) -> K
Borrow from left sibling
§Invariant
Caller must have verified that left.keys.len() > MIN_KEYS before
invoking this function (see rebalance logic in tree.rs). Otherwise
borrowing would violate the B-tree invariant on the sibling.
Sourcepub fn borrow_from_right(&mut self, right: &mut Self, parent_key: &K) -> K
pub fn borrow_from_right(&mut self, right: &mut Self, parent_key: &K) -> K
Borrow from right sibling
Trait Implementations§
Source§impl<K, V> Debug for InternalNode<K, V>
impl<K, V> Debug for InternalNode<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for InternalNode<K, V>
impl<K, V> RefUnwindSafe for InternalNode<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for InternalNode<K, V>
impl<K, V> Sync for InternalNode<K, V>
impl<K, V> Unpin for InternalNode<K, V>
impl<K, V> UnsafeUnpin for InternalNode<K, V>
impl<K, V> UnwindSafe for InternalNode<K, V>where
V: UnwindSafe,
K: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request