LeafNode

Struct LeafNode 

Source
pub struct LeafNode<T, S: Storage<T>> { /* private fields */ }

Implementations§

Source§

impl<T, S: Storage<T>> Leaf<T, S>

Source

pub fn new(parent: Option<S::Node>, items: Array<T, { _ }>) -> Self

Source

pub fn from_item(parent: Option<S::Node>, item: T) -> Leaf<T, S>

Source

pub fn forget(&mut self)

Forget the node content without running the items destructors.

Source

pub fn parent(&self) -> Option<S::Node>

Source

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

Source

pub fn item_count(&self) -> usize

Source

pub fn items(&self) -> &Array<T, { _ }>

Source

pub fn iter(&self) -> Iter<'_, T>

Source

pub fn get<Q: ?Sized>( &self, cmp: impl Fn(&T, &Q) -> Ordering, key: &Q, ) -> Option<&T>

Source

pub fn get_mut<Q: ?Sized>( &mut self, cmp: impl Fn(&T, &Q) -> Ordering, key: &Q, ) -> Option<&mut T>

Source

pub fn offset_of<Q: ?Sized>( &self, cmp: impl Fn(&T, &Q) -> Ordering, key: &Q, ) -> Result<Offset, Offset>

Find the offset of the item matching the given key.

Source

pub fn item(&self, offset: Offset) -> Option<&T>

Source

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

Source

pub fn insert_by_key( &mut self, cmp: impl Fn(&T, &T) -> Ordering, item: T, ) -> (Offset, Option<T>)

Source

pub fn split(&mut self) -> (usize, T, Leaf<T, S>)

Source

pub fn append(&mut self, separator: T, other: Leaf<T, S>) -> Offset

Source

pub fn push_left(&mut self, item: T)

Source

pub fn pop_left(&mut self) -> Result<T, WouldUnderflow>

Source

pub fn push_right(&mut self, item: T) -> Offset

Source

pub fn pop_right(&mut self) -> Result<(Offset, T), 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: T)

It is assumed that the leaf will not overflow.

Source

pub fn remove(&mut self, offset: Offset) -> T

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

Source

pub fn remove_last(&mut self) -> T

Source

pub fn validate( &self, cmp: impl Fn(&T, &T) -> Ordering, parent: Option<S::Node>, min: Option<&T>, max: Option<&T>, )

Trait Implementations§

Source§

impl<T: Clone, S: Clone + Storage<T>> Clone for Leaf<T, S>
where S::Node: Clone,

Source§

fn clone(&self) -> Leaf<T, S>

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<T, S> Freeze for Leaf<T, S>
where <S as Storage<T>>::Node: Freeze, T: Freeze,

§

impl<T, S> RefUnwindSafe for Leaf<T, S>
where <S as Storage<T>>::Node: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, S> Send for Leaf<T, S>
where <S as Storage<T>>::Node: Send, T: Send,

§

impl<T, S> Sync for Leaf<T, S>
where <S as Storage<T>>::Node: Sync, T: Sync,

§

impl<T, S> Unpin for Leaf<T, S>
where <S as Storage<T>>::Node: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for Leaf<T, S>
where <S as Storage<T>>::Node: UnwindSafe, T: 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.