Struct blart::Header

source ·
pub struct Header {
    pub num_children: u16,
    pub prefix: TinyVec<[u8; 8]>,
}
Expand description

The common header for all inner nodes

Fields§

§num_children: u16

Number of children of this inner node. This field has no meaning for a leaf node.

§prefix: TinyVec<[u8; 8]>

The key prefix for this node.

Implementations§

source§

impl Header

source

pub fn empty() -> Self

Create a new Header for an empty node.

source

pub fn extend_prefix(&mut self, new_bytes: &[u8])

Write prefix bytes to this header, appending to existing bytes if present.

source

pub fn prepend_prefix(&mut self, new_bytes: &[u8])

Write bytes to the start of the key prefix.

source

pub fn ltrim_prefix(&mut self, num_bytes: usize)

Remove the specified number of bytes from the start of the prefix.

Panics
  • Panics if the number of bytes to remove is greater than the prefix size.
source

pub fn read_prefix(&self) -> &[u8]

Read the initialized portion of the prefix present in the header.

source

pub fn prefix_size(&self) -> usize

Return the number of bytes in the prefix.

source

pub fn match_prefix(&self, possible_key: &[u8]) -> usize

Compares the compressed path of a node with the key and returns the number of equal bytes.

source

pub fn num_children(&self) -> usize

Return the number of children of this node.

Trait Implementations§

source§

impl Clone for Header

source§

fn clone(&self) -> Header

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Header

source§

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

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

impl Default for Header

source§

fn default() -> Header

Returns the “default value” for a type. Read more
source§

impl PartialEq<Header> for Header

source§

fn eq(&self, other: &Header) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Header

source§

impl StructuralEq for Header

source§

impl StructuralPartialEq for Header

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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 Twhere 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 Twhere 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.