Struct InnerNode

Source
pub struct InnerNode<K: Key, A: Argument<K>> { /* private fields */ }
Expand description

Tree’s inner node, it contains a list of keys and a list of child node id N is the maximum number of keys in a node C is the maximum child node id in a node

Implementations§

Source§

impl<K: Key, A: Argument<K>> InnerNode<K, A>

Source

pub fn len(&self) -> usize

Size of keys in inner node

Source

pub const fn max_capacity() -> u16

Max key capacity

Source

pub const fn split_origin_size() -> usize

The size of the origin node after split

Source

pub const fn split_new_size() -> usize

The size of the new node after split

Source

pub fn able_to_lend(&self) -> bool

whether this node is able to lend a key to its sibling

Source

pub fn is_full(&self) -> bool

whether this node is full, if yes, then the next insert need to split

Source

pub fn new_from_iter( keys: impl IntoIterator<Item = K>, childs: impl IntoIterator<Item = NodeId>, arguments: impl IntoIterator<Item = A>, ) -> Box<Self>

Create a new inner node from keys and childs iterator

Source

pub fn locate_child<Q>(&self, k: &Q) -> (usize, NodeId)
where K: Borrow<Q>, Q: Ord + ?Sized,

returns the child index for k

Source

pub fn push(&mut self, k: K, child: NodeId, argument: A)

Source

pub fn key(&self, idx: usize) -> &K

Trait Implementations§

Source§

impl<K: Key, A: Argument<K>> Clone for InnerNode<K, A>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug + Key, A: Debug + Argument<K>> Debug for InnerNode<K, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: Key, A: Argument<K>> Drop for InnerNode<K, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<K, A> Freeze for InnerNode<K, A>
where K: Freeze, A: Freeze,

§

impl<K, A> RefUnwindSafe for InnerNode<K, A>

§

impl<K, A> Send for InnerNode<K, A>
where K: Send, A: Send,

§

impl<K, A> Sync for InnerNode<K, A>
where K: Sync, A: Sync,

§

impl<K, A> Unpin for InnerNode<K, A>
where K: Unpin, A: Unpin,

§

impl<K, A> UnwindSafe for InnerNode<K, A>
where K: UnwindSafe, A: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.