Struct InnerNodeCompressed

Source
#[repr(C, align(8))]
pub struct InnerNodeCompressed<K, V, const PREFIX_LEN: usize, const SIZE: usize> { pub header: Header<PREFIX_LEN>, pub keys: [MaybeUninit<u8>; SIZE], pub child_pointers: [MaybeUninit<OpaqueNodePtr<K, V, PREFIX_LEN>>; SIZE], }
Expand description

Node type that has a compact representation for key bytes and children pointers.

Fields§

§header: Header<PREFIX_LEN>

The common node fields.

§keys: [MaybeUninit<u8>; SIZE]

An array that contains single key bytes in the same index as the child_pointers array contains the matching child tree.

This array will only be initialized for the first header.num_children values.

§child_pointers: [MaybeUninit<OpaqueNodePtr<K, V, PREFIX_LEN>>; SIZE]

An array that contains the child data.

This array will only be initialized for the first header.num_children values.

Implementations§

Source§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

Source

pub fn initialized_portion(&self) -> (&[u8], &[OpaqueNodePtr<K, V, PREFIX_LEN>])

Return the initialized portions of the keys and child pointer arrays.

Source

fn lookup_child_inner( &self, key_fragment: u8, ) -> Option<OpaqueNodePtr<K, V, PREFIX_LEN>>

Generalized version of InnerNode::lookup_child for compressed nodes

Source

fn write_child_inner( &mut self, key_fragment: u8, child_pointer: OpaqueNodePtr<K, V, PREFIX_LEN>, )

Writes a child to the node by check the order of insertion

§Panics
  • This functions assumes that the write is gonna be inbound (i.e the check for a full node is done previously to the call of this function)
Source

pub unsafe fn write_child_unchecked( &mut self, key_fragment: u8, child_pointer: OpaqueNodePtr<K, V, PREFIX_LEN>, )

Writes a child to the node without bounds check or order

§Safety
  • This functions assumes that the write is gonna be inbound (i.e the check for a full node is done previously to the call of this function)
Source

unsafe fn write_child_at( &mut self, idx: usize, key_fragment: u8, child_pointer: OpaqueNodePtr<K, V, PREFIX_LEN>, )

Writes a child to the node without bounds check or order

§Safety
  • This functions assumes that the write is gonna be inbound (i.e the check for a full node is done previously to the call of this function)
Source

fn remove_child_inner( &mut self, key_fragment: u8, ) -> Option<OpaqueNodePtr<K, V, PREFIX_LEN>>

Removes child if it exists

Source

fn change_block_size<const NEW_SIZE: usize>( &self, ) -> InnerNodeCompressed<K, V, PREFIX_LEN, NEW_SIZE>

Grows or shrinks the node

Source

fn grow_node48(&self) -> InnerNode48<K, V, PREFIX_LEN>

Transform node into a InnerNode48

Source

fn inner_iter(&self) -> InnerNodeCompressedIter<'_, K, V, PREFIX_LEN>

Get an iterator over the keys and values of the node

Source

fn inner_range_iter( &self, bound: impl RangeBounds<u8>, ) -> InnerNodeCompressedIter<'_, K, V, PREFIX_LEN>

Get an iterator over a range of keys and values of the node.

Trait Implementations§

Source§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> Clone for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

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, V, const PREFIX_LEN: usize, const SIZE: usize> Debug for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

Source§

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

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

impl<K: AsBytes, V, const PREFIX_LEN: usize, const SIZE: usize> FuzzySearch<K, V, PREFIX_LEN> for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>
where Self: InnerNode<PREFIX_LEN, Key = K, Value = V>,

Source§

fn fuzzy_search_prefix( &self, key: &[u8], old_row: &mut &mut [usize], new_row: &mut &mut [MaybeUninit<usize>], max_edit_dist: usize, ) -> bool
where Self: InnerNode<PREFIX_LEN>, Self::Key: AsBytes,

Auto Trait Implementations§

§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> Freeze for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> RefUnwindSafe for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> !Send for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> !Sync for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>

§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> Unpin for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>
where K: Unpin, V: Unpin,

§

impl<K, V, const PREFIX_LEN: usize, const SIZE: usize> UnwindSafe for InnerNodeCompressed<K, V, PREFIX_LEN, SIZE>
where K: UnwindSafe, V: 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.