[−][src]Struct merk::tree::Walker
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]
S: Fetch + Sized + Send + Clone,
pub fn apply_to(
maybe_tree: Option<Self>,
batch: &Batch
) -> Result<(Option<Tree>, LinkedList<Vec<u8>>)>
[src]
maybe_tree: Option<Self>,
batch: &Batch
) -> Result<(Option<Tree>, LinkedList<Vec<u8>>)>
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]
S: Fetch + Sized + Clone + Send,
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]
F: FnOnce(Option<Self>) -> Result<Option<T>>,
T: Into<Tree>,
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]
F: FnOnce(Self) -> Result<Option<T>>,
T: Into<Tree>,
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]
T: Into<Tree>,
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
Auto Trait Implementations
impl<S> RefUnwindSafe for Walker<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for Walker<S>
impl<S> Sync for Walker<S> where
S: Sync,
S: Sync,
impl<S> Terminated for Walker<S> where
S: Terminated,
S: Terminated,
impl<S> Unpin for Walker<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for Walker<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,