Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/experimental/zipper_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ impl<V: Clone + Send + Sync + Unpin, A: Allocator> ZipperAlgebraExt<V, A>
{
}

impl<V: Clone + Send + Sync + Unpin, A: Allocator> ZipperAlgebraExt<V, A>
for ReadZipperOwned<V, A>
{
}

impl<Z, V: Clone + Send + Sync + Unpin, A: Allocator> ZipperAlgebraExt<V, A> for PrefixZipper<'_, Z> where
Z: ZipperInfallibleSubtries<V, A> + ZipperSubtries<V, A> + ZipperConcrete + ZipperMoving
{
}

/// Performs an ordered join (least upper bound) of two radix-256 tries using zipper traversal.
///
/// This function merges two tries by simultaneously traversing them in lexicographic order,
Expand Down Expand Up @@ -1760,6 +1770,8 @@ mod zipper_algebra_poly {
pub(super) enum SomeMutRefZ<'a, 'trie, 'path, V: Clone + Send + Sync + Unpin, A: Allocator> {
RZ(&'a mut ReadZipperUntracked<'trie, 'path, V, A>),
RZT(&'a mut ReadZipperTracked<'trie, 'path, V, A>),
PZRZ(&'a mut PrefixZipper<'a, ReadZipperUntracked<'trie, 'path, V, A>>),
PZRZT(&'a mut PrefixZipper<'a, ReadZipperTracked<'trie, 'path, V, A>>),
}

impl<V: Clone + Send + Sync + Unpin, A: Allocator> ZipperInfallibleSubtries<V, A>
Expand All @@ -1769,27 +1781,35 @@ mod zipper_algebra_poly {
match self {
SomeMutRefZ::RZ(inner) => inner.make_map(),
SomeMutRefZ::RZT(inner) => inner.make_map(),
SomeMutRefZ::PZRZ(inner) => inner.make_map(),
SomeMutRefZ::PZRZT(inner) => inner.make_map(),
}
}

fn get_trie_ref(&self) -> TrieRef<'_, V, A> {
match self {
SomeMutRefZ::RZ(inner) => inner.get_trie_ref(),
SomeMutRefZ::RZT(inner) => inner.get_trie_ref(),
SomeMutRefZ::PZRZ(inner) => inner.get_trie_ref(),
SomeMutRefZ::PZRZT(inner) => inner.get_trie_ref(),
}
}

fn get_focus(&self) -> OpaqueAbstractNodeRef<'_, V, A> {
match self {
SomeMutRefZ::RZ(inner) => inner.get_focus(),
SomeMutRefZ::RZT(inner) => inner.get_focus(),
SomeMutRefZ::PZRZ(inner) => inner.get_focus(),
SomeMutRefZ::PZRZT(inner) => inner.get_focus(),
}
}

fn try_borrow_focus(&self) -> Option<OpaqueTrieNodeRef<'_, V, A>> {
match self {
SomeMutRefZ::RZ(inner) => inner.try_borrow_focus(),
SomeMutRefZ::RZT(inner) => inner.try_borrow_focus(),
SomeMutRefZ::PZRZ(inner) => inner.try_borrow_focus(),
SomeMutRefZ::PZRZT(inner) => inner.try_borrow_focus(),
}
}
}
Expand Down