From 68c4a9f703c6286219be56b8ba870771818ace23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Rze=C5=BAnicki?= Date: Fri, 8 May 2026 23:09:03 +0200 Subject: [PATCH 1/2] zipper_algebra: support more zippers --- src/experimental/zipper_algebra.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/experimental/zipper_algebra.rs b/src/experimental/zipper_algebra.rs index 8faa16e..3b34538 100644 --- a/src/experimental/zipper_algebra.rs +++ b/src/experimental/zipper_algebra.rs @@ -98,6 +98,16 @@ impl ZipperAlgebraExt { } +impl ZipperAlgebraExt + for ReadZipperOwned +{ +} + +impl ZipperAlgebraExt for PrefixZipper<'_, Z> where + Z: ZipperInfallibleSubtries + ZipperSubtries + 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, @@ -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 ZipperInfallibleSubtries @@ -1769,6 +1781,8 @@ 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(), } } @@ -1776,6 +1790,8 @@ mod zipper_algebra_poly { 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(), } } @@ -1783,6 +1799,8 @@ mod zipper_algebra_poly { 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(), } } @@ -1790,6 +1808,8 @@ mod zipper_algebra_poly { match self { SomeMutRefZ::RZ(inner) => inner.get_focus_at(path), SomeMutRefZ::RZT(inner) => inner.get_focus_at(path), + SomeMutRefZ::PZRZ(inner) => inner.get_focus_at(path), + SomeMutRefZ::PZRZT(inner) => inner.get_focus_at(path), } } @@ -1797,6 +1817,8 @@ mod zipper_algebra_poly { 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(), } } } From f6f6ac58367a3c9d3f08aed495ca499508bfd971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Rze=C5=BAnicki?= Date: Mon, 11 May 2026 20:55:07 +0200 Subject: [PATCH 2/2] write_zipper: Remove deprecated API --- src/experimental/zipper_algebra.rs | 10 +++++----- src/write_zipper.rs | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/experimental/zipper_algebra.rs b/src/experimental/zipper_algebra.rs index 3b34538..844d97c 100644 --- a/src/experimental/zipper_algebra.rs +++ b/src/experimental/zipper_algebra.rs @@ -1485,7 +1485,7 @@ impl MergePolicy for Join { Z: ZipperInfallibleSubtries + ZipperMoving, Out: ZipperWriting, { - out.graft_children(z, range); + out.graft_masked_branches(z, range, false) } #[inline] @@ -1500,7 +1500,7 @@ impl MergePolicy for Join { Z: ZipperInfallibleSubtries + ZipperConcrete + ZipperMoving, Out: ZipperWriting, { - out.graft_children(z, ByteMask::FULL); + out.graft_masked_branches(z, ByteMask::FULL, false) } } @@ -1575,7 +1575,7 @@ impl MergePolicy for Meet { Z: ZipperInfallibleSubtries + ZipperConcrete + ZipperMoving, Out: ZipperWriting, { - out.graft_children(z, ByteMask::FULL); + out.graft_masked_branches(z, ByteMask::FULL, false); } } @@ -1650,7 +1650,7 @@ impl MergePolicy for Subtract { Z: ZipperInfallibleSubtries + ZipperMoving, Out: ZipperWriting, { - out.graft_children(z, range); + out.graft_masked_branches(z, range, false); } #[inline] @@ -1670,7 +1670,7 @@ impl MergePolicy for Subtract { Out: ZipperWriting, { if mask == 1 { - out.graft_children(z, range); + out.graft_masked_branches(z, range, false) } } diff --git a/src/write_zipper.rs b/src/write_zipper.rs index dbc48df..a596adc 100644 --- a/src/write_zipper.rs +++ b/src/write_zipper.rs @@ -139,12 +139,6 @@ pub trait ZipperWriting: Wri } } - /// Deprecated alias for [graft_masked_branches](ZipperWriting::graft_masked_branches) - #[deprecated] - fn graft_children>(&mut self, src: &Z, child_mask: ByteMask) { - self.graft_masked_branches(src, child_mask, false) - } - /// Joins (union of) the subtrie below the focus of `read_zipper` into the subtrie downstream from the /// focus of `self` ///