Struct hypertree::llrb::LLRB

source ·
pub struct LLRB<'a, V: Payload> { /* private fields */ }
Expand description

A Left Leaning Red-Black tree which supports random access O(log n) and get max O(1) https://tjkendev.github.io/bst-visualization/red-black-tree/left-leaning.html This does not properly handle equal key values like the regular RBTree because this does top-down deletions and does not branch when it finds an equal key, just stops there.

Implementations§

source§

impl<'a, V: Payload> LLRB<'a, V>

source

pub fn new( data: &'a mut [u8], root_index: DataIndex, max_index: DataIndex ) -> Self

Creates a new LLRB. Does not mutate data yet. Assumes the actual data in data is already well formed as a red black tree.

Trait Implementations§

source§

impl<'a, V: Payload> GetRedBlackTreeData<'a> for LLRB<'a, V>

source§

fn data(&mut self) -> &mut [u8]

source§

fn set_root_index(&mut self, root_index: DataIndex)

source§

impl<'a, V: Payload> GetRedBlackTreeReadOnlyData<'a> for LLRB<'a, V>

source§

impl<'a, V: Payload> HyperTreeWriteOperations<'a, V> for LLRB<'a, V>

source§

fn insert(&mut self, index: DataIndex, value: V)

Insert and rebalance. The data at index should be already zeroed.

source§

fn remove_by_index(&mut self, index: DataIndex)

Remove a node by index and rebalance.

Auto Trait Implementations§

§

impl<'a, V> Freeze for LLRB<'a, V>

§

impl<'a, V> RefUnwindSafe for LLRB<'a, V>
where V: RefUnwindSafe,

§

impl<'a, V> Send for LLRB<'a, V>
where V: Sync,

§

impl<'a, V> Sync for LLRB<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for LLRB<'a, V>

§

impl<'a, V> !UnwindSafe for LLRB<'a, 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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<'a, T> HyperTreeReadOperations<'a> for T

source§

fn lookup_index<V>(&'a self, value: &V) -> u32
where V: Payload,

Lookup the index of a given value.

source§

fn get_max_index(&self) -> u32

Get the max index. If a tree set this to NIL on a non-empty tree, this will always be NIL.

source§

fn get_root_index(&self) -> u32

Get the current root index.

source§

fn get_next_lower_index<V>(&'a self, index: u32) -> u32
where V: Payload,

Get the previous index. This walks the tree, so does not care about equal keys.

source§

fn get_next_higher_index<V>(&'a self, index: u32) -> u32
where V: Payload,

Get the next index. This walks the tree, so does not care about equal keys. Used to swap an internal node with the next leaf, when insert or delete points at an internal node. It should never be called on leaf nodes.

source§

fn lookup_max_index<V>(&'a self) -> u32
where V: Payload,

source§

impl<'a, T> HyperTreeValueIteratorTrait<'a, T> for T

source§

fn iter<V>(&'a self) -> HyperTreeValueReadOnlyIterator<'a, T, V>
where V: Payload,

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