#[repr(C)]
struct InternalNode<K, V> { data: LeafNode<K, V>, edges: [MaybeUninit<NonNull<LeafNode<K, V>>>; 12], }
Expand description

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§

source§

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

source

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> RefUnwindSafe for InternalNode<K, V>where K: RefUnwindSafe, V: 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>where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for InternalNode<K, V>where K: UnwindSafe + RefUnwindSafe, V: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.