[][src]Struct merk::tree::Walker

pub struct Walker<S> where
    S: Fetch + Sized + Clone + Send
{ /* fields omitted */ }

Allows traversal of a Tree, fetching from the given source when traversing to a pruned node, detaching children as they are traversed.

Implementations

impl<S> Walker<S> where
    S: Fetch + Sized + Send + Clone
[src]

pub fn apply_to(
    maybe_tree: Option<Self>,
    batch: &Batch
) -> Result<(Option<Tree>, LinkedList<Vec<u8>>)>
[src]

Applies a batch of operations, possibly creating a new tree if maybe_tree is None. This is similar to Walker<S>::apply, but does not require a non-empty tree.

Keys in batch must be sorted and unique.

pub fn remove(self) -> Result<Option<Self>>[src]

Removes the root node from the tree. Rearranges and rebalances descendants (if any) in order to maintain a valid tree.

impl<S> Walker<S> where
    S: Fetch + Sized + Clone + Send
[src]

pub fn new(tree: Tree, source: S) -> Self[src]

Creates a Walker with the given tree and source.

pub unsafe fn detach(self, left: bool) -> Result<(Self, Option<Self>)>[src]

Similar to Tree#detach, but yields a Walker which fetches from the same source as self. Returned tuple is (updated_self, maybe_child_walker).

pub unsafe fn detach_expect(self, left: bool) -> Result<(Self, Self)>[src]

Similar to Tree#detach_expect, but yields a Walker which fetches from the same source as self. Returned tuple is (updated_self, child_walker).

pub fn walk<F, T>(self, left: bool, f: F) -> Result<Self> where
    F: FnOnce(Option<Self>) -> Result<Option<T>>,
    T: Into<Tree>, 
[src]

Similar to Tree#walk, but yields a Walker which fetches from the same source as self.

pub fn walk_expect<F, T>(self, left: bool, f: F) -> Result<Self> where
    F: FnOnce(Self) -> Result<Option<T>>,
    T: Into<Tree>, 
[src]

Similar to Tree#walk_expect but yields a Walker which fetches from the same source as self.

pub fn tree(&self) -> &Tree[src]

Returns an immutable reference to the Tree wrapped by this walker.

pub fn into_inner(self) -> Tree[src]

Consumes the Walker and returns the Tree it wraps.

pub fn clone_source(&self) -> S[src]

Returns a clone of this Walker's source.

pub fn attach<T>(self, left: bool, maybe_child: Option<T>) -> Self where
    T: Into<Tree>, 
[src]

Similar to Tree#attach, but can also take a Walker since it implements Into<Tree>.

pub fn with_value(self, value: Vec<u8>) -> Self[src]

Similar to Tree#with_value.

Trait Implementations

impl<S> From<Walker<S>> for Tree where
    S: Fetch + Sized + Clone + Send
[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for Walker<S> where
    S: RefUnwindSafe

impl<S> Send for Walker<S>

impl<S> Sync for Walker<S> where
    S: Sync

impl<S> Terminated for Walker<S> where
    S: Terminated

impl<S> Unpin for Walker<S> where
    S: Unpin

impl<S> UnwindSafe for Walker<S> where
    S: UnwindSafe

Blanket Implementations

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

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

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

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

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

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.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,