Skip to main content

InteriorPage

Struct InteriorPage 

Source
pub struct InteriorPage { /* private fields */ }
Expand description

An interior B-Tree page. Owns a heap-allocated 4089-byte payload buffer.

Implementations§

Source§

impl InteriorPage

Source

pub fn empty(rightmost_child: u32) -> Self

Creates an empty interior page with the given rightmost-child pointer. Every interior page must have a valid rightmost-child — even if no dividers are present, the rightmost pointer serves as the catch-all route for all rowids.

Source

pub fn from_bytes(bytes: &[u8; 4089]) -> Self

Source

pub fn as_bytes(&self) -> &[u8; 4089]

Source

pub fn slot_count(&self) -> usize

Source

pub fn cells_top(&self) -> usize

Source

pub fn rightmost_child(&self) -> u32

Source

pub fn set_rightmost_child(&mut self, page: u32)

Source

pub fn free_space(&self) -> usize

Source

pub fn would_fit(&self, cell_encoded_size: usize) -> bool

Source

pub fn divider_at(&self, slot: usize) -> Result<i64>

Divider rowid of the cell at slot, without full decode.

Source

pub fn cell_at(&self, slot: usize) -> Result<InteriorCell>

Source

pub fn insert_divider( &mut self, divider_rowid: i64, child_page: u32, ) -> Result<()>

Inserts a divider in ascending divider_rowid order. Returns an error if the new divider duplicates an existing one — the bulk-build code that populates interior pages always passes strictly increasing dividers, so a duplicate means a programmer-level bug.

Source

pub fn child_for(&self, rowid: i64) -> Result<u32>

Returns the child page that rowid routes to: the first divider with rowid <= divider owns the subtree; if rowid is larger than every divider, the rightmost child catches it.

Source

pub fn leftmost_child(&self) -> Result<u32>

Returns the child page to descend into to find the smallest rowid under this interior. If there are dividers, it’s slot 0’s child; otherwise it’s the rightmost (which is also the only) child.

Auto Trait Implementations§

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<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>,

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.