pub struct LeafNode<T, S: Storage<T>> { /* private fields */ }Implementations§
Source§impl<T, S: Storage<T>> Leaf<T, S>
impl<T, S: Storage<T>> Leaf<T, S>
pub fn new(parent: Option<S::Node>, items: Array<T, { _ }>) -> Self
pub fn from_item(parent: Option<S::Node>, item: T) -> Leaf<T, S>
pub fn parent(&self) -> Option<S::Node>
pub fn set_parent(&mut self, p: Option<S::Node>)
pub fn item_count(&self) -> usize
pub fn items(&self) -> &Array<T, { _ }>
pub fn iter(&self) -> Iter<'_, T>
pub fn get<Q: ?Sized>( &self, cmp: impl Fn(&T, &Q) -> Ordering, key: &Q, ) -> Option<&T>
pub fn get_mut<Q: ?Sized>( &mut self, cmp: impl Fn(&T, &Q) -> Ordering, key: &Q, ) -> Option<&mut T>
Sourcepub fn offset_of<Q: ?Sized>(
&self,
cmp: impl Fn(&T, &Q) -> Ordering,
key: &Q,
) -> Result<Offset, Offset>
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.
pub fn item(&self, offset: Offset) -> Option<&T>
pub fn item_mut(&mut self, offset: Offset) -> Option<&mut T>
pub fn insert_by_key( &mut self, cmp: impl Fn(&T, &T) -> Ordering, item: T, ) -> (Offset, Option<T>)
pub fn split(&mut self) -> (usize, T, Leaf<T, S>)
pub fn append(&mut self, separator: T, other: Leaf<T, S>) -> Offset
pub fn push_left(&mut self, item: T)
pub fn pop_left(&mut self) -> Result<T, WouldUnderflow>
pub fn push_right(&mut self, item: T) -> Offset
pub fn pop_right(&mut self) -> Result<(Offset, T), WouldUnderflow>
pub fn balance(&self) -> Balance
pub fn is_overflowing(&self) -> bool
pub fn is_underflowing(&self) -> bool
Sourcepub fn insert(&mut self, offset: Offset, item: T)
pub fn insert(&mut self, offset: Offset, item: T)
It is assumed that the leaf will not overflow.
Sourcepub fn remove(&mut self, offset: Offset) -> T
pub fn remove(&mut self, offset: Offset) -> T
Remove the item at the given offset. Return the new balance of the leaf.
pub fn remove_last(&mut self) -> T
pub fn validate( &self, cmp: impl Fn(&T, &T) -> Ordering, parent: Option<S::Node>, min: Option<&T>, max: Option<&T>, )
Trait Implementations§
Auto Trait Implementations§
impl<T, S> Freeze for Leaf<T, S>
impl<T, S> RefUnwindSafe for Leaf<T, S>
impl<T, S> Send for Leaf<T, S>
impl<T, S> Sync for Leaf<T, S>
impl<T, S> Unpin for Leaf<T, S>
impl<T, S> UnwindSafe for Leaf<T, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more