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
impl Header
sourcepub fn extend_prefix(&mut self, new_bytes: &[u8])
pub fn extend_prefix(&mut self, new_bytes: &[u8])
Write prefix bytes to this header, appending to existing bytes if present.
sourcepub fn prepend_prefix(&mut self, new_bytes: &[u8])
pub fn prepend_prefix(&mut self, new_bytes: &[u8])
Write bytes to the start of the key prefix.
sourcepub fn ltrim_prefix(&mut self, num_bytes: usize)
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.
sourcepub fn read_prefix(&self) -> &[u8] ⓘ
pub fn read_prefix(&self) -> &[u8] ⓘ
Read the initialized portion of the prefix present in the header.
sourcepub fn prefix_size(&self) -> usize
pub fn prefix_size(&self) -> usize
Return the number of bytes in the prefix.
sourcepub fn match_prefix(&self, possible_key: &[u8]) -> usize
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.
sourcepub fn num_children(&self) -> usize
pub fn num_children(&self) -> usize
Return the number of children of this node.
Trait Implementations§
source§impl PartialEq<Header> for Header
impl PartialEq<Header> for Header
impl Eq for Header
impl StructuralEq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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