Struct InternalNode

#[repr(C)]
pub(in ::collections::btree::node) struct InternalNode<K, V> { pub(in ::collections::btree::node) data: LeafNode<K, V>, pub(in ::collections::btree::node) edges: [MaybeUninit<NonNull<LeafNode<K, V>>>; 12] }

The underlying representation of internal nodes. As with LeafNodes, these should be hidden behind BoxedNodes to prevent dropping uninitialized keys and values. Any pointer to an InternalNode can be directly cast to a pointer to the underlying LeafNode portion of the node, allowing code to act on leaf and internal nodes generically without having to even check which of the two a pointer is pointing at. This property is enabled by the use of repr(C).

Fields

data: LeafNode<K, V>
edges: [MaybeUninit<NonNull<LeafNode<K, V>>>; 12]

The pointers to the children of this node. len + 1 of these are considered initialized and valid, except that near the end, while the tree is held through borrow type Dying, some of these pointers are dangling.

Implementations

impl<K, V> InternalNode<K, V>

unsafe fn new<A: Allocator + Clone>(alloc: A) -> Box<Self, A>

Creates a new boxed InternalNode.

Safety

An invariant of internal nodes is that they have at least one initialized and valid edge. This function does not set up such an edge.

Auto Trait Implementations

impl<K, V> !Send for InternalNode<K, V>

impl<K, V> !Sync for InternalNode<K, V>

impl<K, V> Freeze for InternalNode<K, V> where LeafNode<K, V>: Freeze, [MaybeUninit<NonNull<LeafNode<K, V>>>; 12]: Freeze,

impl<K, V> RefUnwindSafe for InternalNode<K, V> where LeafNode<K, V>: RefUnwindSafe, [MaybeUninit<NonNull<LeafNode<K, V>>>; 12]: RefUnwindSafe,

impl<K, V> Unpin for InternalNode<K, V> where LeafNode<K, V>: Unpin, [MaybeUninit<NonNull<LeafNode<K, V>>>; 12]: Unpin,

impl<K, V> UnsafeUnpin for InternalNode<K, V> where LeafNode<K, V>: UnsafeUnpin, [MaybeUninit<NonNull<LeafNode<K, V>>>; 12]: UnsafeUnpin,

impl<K, V> UnwindSafe for InternalNode<K, V> where LeafNode<K, V>: UnwindSafe, [MaybeUninit<NonNull<LeafNode<K, V>>>; 12]: UnwindSafe,

Blanket Implementations

impl<T> Any for InternalNode<K, V> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for InternalNode<K, V> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for InternalNode<K, V> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for InternalNode<K, V>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for InternalNode<K, V> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for InternalNode<K, V>

impl<T, U> Into<U> for InternalNode<K, V> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for InternalNode<K, V> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for InternalNode<K, V> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>