LeafNode

Struct LeafNode 

Source
pub struct LeafNode<K, V> { /* private fields */ }

Implementations§

Source§

impl<K, V> Leaf<K, V>

Source

pub fn new(parent: Option<usize>, item: Item<K, V>) -> Leaf<K, V>

Source

pub fn parent(&self) -> Option<usize>

Source

pub fn set_parent(&mut self, p: Option<usize>)

Source

pub fn item_count(&self) -> usize

Source

pub fn items(&self) -> &[Item<K, V>]

Source

pub fn iter(&self) -> Iter<'_, Item<K, V>>

Source

pub fn get<Q>(&self, key: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source

pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source

pub fn offset_of<Q>(&self, key: &Q) -> Result<Offset, Offset>
where K: Borrow<Q>, Q: Ord + ?Sized,

Find the offset of the item matching the given key.

Source

pub fn item(&self, offset: Offset) -> Option<&Item<K, V>>

Source

pub fn item_mut(&mut self, offset: Offset) -> Option<&mut Item<K, V>>

Source

pub fn insert_by_key(&mut self, key: K, value: V) -> (Offset, Option<V>)
where K: Ord,

Source

pub fn split(&mut self) -> (usize, Item<K, V>, Leaf<K, V>)

Source

pub fn append(&mut self, separator: Item<K, V>, other: Leaf<K, V>) -> Offset

Source

pub fn push_left(&mut self, item: Item<K, V>)

Source

pub fn pop_left(&mut self) -> Result<Item<K, V>, WouldUnderflow>

Source

pub fn push_right(&mut self, item: Item<K, V>) -> Offset

Source

pub fn pop_right(&mut self) -> Result<(Offset, Item<K, V>), WouldUnderflow>

Source

pub fn balance(&self) -> Balance

Source

pub fn is_overflowing(&self) -> bool

Source

pub fn is_underflowing(&self) -> bool

Source

pub fn insert(&mut self, offset: Offset, item: Item<K, V>)

It is assumed that the leaf will not overflow.

Source

pub fn remove(&mut self, offset: Offset) -> Item<K, V>

Remove the item at the given offset. Return the new balance of the leaf.

Source

pub fn remove_last(&mut self) -> Item<K, V>

Source

pub fn validate(&self, parent: Option<usize>, min: Option<&K>, max: Option<&K>)
where K: Ord,

Trait Implementations§

Source§

impl<K: Clone, V: Clone> Clone for Leaf<K, V>

Source§

fn clone(&self) -> Leaf<K, V>

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

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<K, V> Freeze for Leaf<K, V>
where K: Freeze, V: Freeze,

§

impl<K, V> RefUnwindSafe for Leaf<K, V>

§

impl<K, V> Send for Leaf<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for Leaf<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for Leaf<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for Leaf<K, V>

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.