Skip to main content

Open

Struct Open 

Source
struct Open {
    left: Option<Cid>,
    entries: Vec<(Vec<u8>, Cid, Option<Cid>)>,
}
Expand description

A node with its keys written out whole, which is how an edit works on it.

A stored node writes each key as a prefix of the one before it, which is only meaningful while the entries stay where they are. An edit moves entries between nodes, so it opens a node into this, works on it, and closes it back into a Node that computes the prefixes afresh.

Fields§

§left: Option<Cid>

The subtree before the first entry.

§entries: Vec<(Vec<u8>, Cid, Option<Cid>)>

Each entry’s whole key, its value, and the subtree to its right.

Implementations§

Source§

impl Open

Source

fn of(node: &Node) -> Self

Opens a stored node.

Source

fn close(&self) -> Node

Closes it back into a node, each key written against the one before.

Source

fn is_empty(&self) -> bool

Whether it holds nothing at all, which is no node.

Source

fn position(&self, key: &[u8]) -> usize

How many entries sort before key.

Source

fn slot(&self, at: usize) -> Option<Cid>

The subtree just before entry at: left for the first, and the previous entry’s right-hand subtree for every other.

Source

fn set_slot(&mut self, at: usize, subtree: Option<Cid>)

Replaces the subtree just before entry at.

Trait Implementations§

Source§

impl Debug for Open

Source§

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

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

impl Default for Open

Source§

fn default() -> Open

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

Auto Trait Implementations§

§

impl Freeze for Open

§

impl RefUnwindSafe for Open

§

impl Send for Open

§

impl Sync for Open

§

impl Unpin for Open

§

impl UnsafeUnpin for Open

§

impl UnwindSafe for Open

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> Same for T

Source§

type Output = T

Should always be Self
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.