BtreeNode

Struct BtreeNode 

Source
#[repr(C, align(8))]
pub struct BtreeNode<'a, K, V, P> { /* private fields */ }
Expand description

btree node descriptor for memory pointer, normally a page

SAFETY: node operations mutable by unsafe code, this works because all ops for same node are expected to be ran in a single thread

Implementations§

Source§

impl<'a, K, V, P> BtreeNode<'a, K, V, P>

Source

pub fn from_slice(buf: &[u8]) -> Self

Source

pub fn new(size: usize) -> Option<Self>

Source

pub fn new_with_id(size: usize, id: &P) -> Option<Self>

Source

pub fn copy_from_slice(id: P, buf: &[u8]) -> Option<Self>

Source

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

Source

pub fn as_mut(&self) -> &mut [u8]

Source

pub fn is_leaf(&self) -> bool

Source

pub fn set_leaf(&self)

Source

pub fn clear_leaf(&self)

Source

pub fn is_large(&self) -> bool

Source

pub fn set_large(&self)

Source

pub fn clear_large(&self)

Source

pub fn get_flags(&self) -> u8

Source

pub fn set_flags(&self, flags: u8)

Source

pub fn get_level(&self) -> usize

Source

pub fn set_level(&self, level: usize)

Source

pub fn get_key(&self, index: usize) -> &K

Source

pub fn set_key(&self, index: usize, key: &K)

Source

pub fn get_val<X>(&self, index: usize) -> &X

Source

pub fn set_val<X>(&self, index: usize, val: &X)

Source

pub fn get_nchild(&self) -> usize

Source

pub fn set_nchild(&self, c: usize)

Source

pub fn set_nchild_use_p(&self, c: usize)

Source

pub fn get_userdata(&self) -> u32

Source

pub fn set_userdata(&self, data: u32)

Source

pub fn get_capacity(&self) -> usize

Source

pub fn get_v_capacity(&self) -> usize

Source

pub fn has_free_slots(&self) -> bool

Source

pub fn get_nchild_min(&self) -> usize

Source

pub fn is_overflowing(&self) -> bool

Source

pub fn node_key(&self) -> &K

Source

pub fn id(&self) -> &P

Source

pub fn set_id(&self, id: P)

Source

pub fn init(&self, level: usize, nchild: usize)

Source

pub fn init_root(&self, level: usize, is_large: bool)

Source

pub fn is_dirty(&self) -> bool

Source

pub fn mark_dirty(&self)

Source

pub fn clear_dirty(&self)

Source

pub fn move_left( left: &BtreeNode<'_, K, V, P>, right: &BtreeNode<'_, K, V, P>, n: usize, )

Source

pub fn move_right( left: &BtreeNode<'_, K, V, P>, right: &BtreeNode<'_, K, V, P>, n: usize, )

Source

pub fn lookup(&self, key: &K) -> (bool, usize)

Source

pub fn insert<X>(&self, index: usize, key: &K, val: &X)

Source

pub fn delete<X: Copy>(&self, index: usize, key: &mut K, val: &mut X)

Trait Implementations§

Source§

impl<'a, K: Debug, V: Debug, P: Debug> Debug for BtreeNode<'a, K, V, P>

Source§

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

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

impl<'a, K, V, P> Display for BtreeNode<'a, K, V, P>

Source§

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

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

impl<'a, K, V, P> Drop for BtreeNode<'a, K, V, P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, K, V, P> PartialEq for BtreeNode<'a, K, V, P>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<'a, K, V, P> Freeze for BtreeNode<'a, K, V, P>
where P: Freeze,

§

impl<'a, K, V, P> RefUnwindSafe for BtreeNode<'a, K, V, P>

§

impl<'a, K, V, P> !Send for BtreeNode<'a, K, V, P>

§

impl<'a, K, V, P> !Sync for BtreeNode<'a, K, V, P>

§

impl<'a, K, V, P> !Unpin for BtreeNode<'a, K, V, P>

§

impl<'a, K, V, P> !UnwindSafe for BtreeNode<'a, K, V, P>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.