Struct sanakirja::btree::page::Page[][src]

pub struct Page<K, V> { /* fields omitted */ }
Expand description

Empty type implementing BTreePage and BTreeMutPage.

Trait Implementations

impl<K, V> BTreeMutPage<K, V> for Page<K, V> where
    K: Storable + Debug,
    V: Storable + Debug
[src]

pub fn init(page: &mut MutPage)[src]

Initialise a page.

type Saved = (K, V)

pub fn save_deleted_leaf_entry(
    k: &K,
    v: &V
) -> <Page<K, V> as BTreeMutPage<K, V>>::Saved
[src]

Save a leaf entry as a replacement, when we delete at an internal node. This can be a pointer to the leaf if the leaf isn’t mutated, or the actual value, or something else. Read more

pub unsafe fn from_saved<'a>(
    s: &<Page<K, V> as BTreeMutPage<K, V>>::Saved
) -> (&'a K, &'a V)
[src]

Recover the saved value.

pub fn put<T>(
    txn: &mut T,
    page: CowPage,
    mutable: bool,
    replace: bool,
    c: &PageCursor,
    k0: &'a K,
    v0: &'a V,
    k1v1: Option<(&'a K, &'a V)>,
    l: u64,
    r: u64
) -> Result<Put<'a, K, V>, <T as LoadPage>::Error> where
    T: AllocPage
[src]

Add an entry to the page, possibly splitting the page in the process. Read more

pub unsafe fn put_mut(
    page: &mut MutPage,
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor,
    k0: &K,
    v0: &V,
    r: u64
)
[src]

Add an entry to page, at position c. Does not check whether there is enough space to do so. This method is mostly useful for cloning pages. Read more

pub unsafe fn set_left_child(
    page: &mut MutPage,
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor,
    l: u64
)
[src]

pub fn update_left_child<T>(
    txn: &mut T,
    page: CowPage,
    mutable: bool,
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor,
    l: u64
) -> Result<Ok, <T as LoadPage>::Error> where
    T: AllocPage
[src]

Update the left child of the position pointed to by the cursor. Read more

pub fn del<T>(
    txn: &mut T,
    page: CowPage,
    mutable: bool,
    c: &PageCursor,
    l: u64
) -> Result<(MutPage, u64), <T as LoadPage>::Error> where
    T: AllocPage
[src]

Delete an entry on the page, returning the resuting page along with the offset of the freed page (or 0 if no page was freed, i.e. if page is mutable). Read more

pub fn merge_or_rebalance<T>(
    txn: &mut T,
    m: Concat<'a, K, V, Page<K, V>>
) -> Result<Op<'a, T, K, V>, <T as LoadPage>::Error> where
    T: AllocPage
[src]

Merge, rebalance or update a concatenation.

impl<K, V> BTreePage<K, V> for Page<K, V> where
    K: Storable,
    V: Storable
[src]

type Cursor = PageCursor

pub fn is_empty(c: &<Page<K, V> as BTreePage<K, V>>::Cursor) -> bool[src]

Whether this cursor is at the end of the page.

pub fn is_init(c: &<Page<K, V> as BTreePage<K, V>>::Cursor) -> bool[src]

Whether this cursor is strictly before the first element.

pub fn cursor_before(p: &CowPage) -> <Page<K, V> as BTreePage<K, V>>::Cursor[src]

Returns a cursor set before the first element of the page (i.e. set to -1). Read more

pub fn cursor_after(p: &CowPage) -> <Page<K, V> as BTreePage<K, V>>::Cursor[src]

Returns a cursor set after the last element of the page (i.e. to element n) Read more

pub fn split_at(
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor
) -> (<Page<K, V> as BTreePage<K, V>>::Cursor, <Page<K, V> as BTreePage<K, V>>::Cursor)
[src]

pub fn move_next(c: &mut <Page<K, V> as BTreePage<K, V>>::Cursor) -> bool[src]

Move the cursor to the next position. Returns whether the cursor was actually moved (i.e. true if and only if the cursor isn’t already after the last element). Read more

pub fn move_prev(c: &mut <Page<K, V> as BTreePage<K, V>>::Cursor) -> bool[src]

Move the cursor to the previous position. Returns whether the cursor was actually moved (i.e. true if and only if the cursor isn’t strictly before the page). Read more

pub fn current<T>(
    _txn: &T,
    page: Page<'a>,
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor
) -> Option<(&'a K, &'a V, u64)> where
    T: LoadPage
[src]

Returns the current element, if the cursor is pointing at one.

pub fn left_child(
    page: Page<'_>,
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor
) -> u64
[src]

Returns the left child of the entry pointed to by the cursor.

pub fn right_child(
    page: Page<'_>,
    c: &<Page<K, V> as BTreePage<K, V>>::Cursor
) -> u64
[src]

Returns the right child of the entry pointed to by the cursor.

pub fn set_cursor<T>(
    txn: &'a T,
    page: Page<'_>,
    c: &mut PageCursor,
    k0: &K,
    v0: Option<&V>
) -> Result<(&'a K, &'a V, u64), usize> where
    T: LoadPage
[src]

Sets the cursor to the last element less than or equal to k0 if v0.is_none(), and to (k0, v0) if v0.is_some(). Read more

fn cursor_first(p: &CowPage) -> Self::Cursor[src]

Returns a cursor set to the first element of the page (i.e. 0). If the page is empty, the returned cursor might be empty. Read more

fn cursor_last(p: &CowPage) -> Self::Cursor[src]

Returns a cursor set to the last element of the page. If the cursor is empty, this is the same as cursor_before. Read more

fn next<T>(
    txn: &T,
    p: Page<'b>,
    c: &mut Self::Cursor
) -> Option<(&'b K, &'b V, u64)> where
    T: LoadPage
[src]

Return the element currently pointed to by the cursor (if the cursor is not before or after the elements of the page), and move the cursor to the next element. Read more

fn prev<T>(
    txn: &T,
    p: Page<'b>,
    c: &mut Self::Cursor
) -> Option<(&'b K, &'b V, u64)> where
    T: LoadPage
[src]

Move the cursor to the previous element, and return that element. In that sense, this is not the symmetric of next. Read more

impl<K, V> Debug for Page<K, V> where
    K: Debug,
    V: Debug
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<K, V> RefUnwindSafe for Page<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for Page<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Page<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for Page<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for Page<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.