feat: implement DoubleEndedIterator for tree iterators#103
Open
NikhilSharmaWe wants to merge 2 commits into
Open
feat: implement DoubleEndedIterator for tree iterators#103NikhilSharmaWe wants to merge 2 commits into
NikhilSharmaWe wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 70.15% 72.32% +2.16%
==========================================
Files 22 22
Lines 1280 1355 +75
==========================================
+ Hits 898 980 +82
+ Misses 382 375 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
Contributor
Author
|
@michaelsproul Could you please take a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #102
Implements
DoubleEndedIteratorforIterandInterfaceIter, solist.iter().rev()andnext_back()work.The backward walk mirrors the existing forward iterator: separate stack, same bit-based descent, same
PackedLeafchunk boundary handling in reverse. Pulled the forward logic into a few helpers (descend_to_target,advance_front,retreat_back) rather than duplicating the match arms.InterfaceIterneeded a bit of extra care. When updates are pending, logical length can be ahead of what's actually in the tree (e.g. push without apply). Skippingtree_iter.next_back()for indices pasttree_backing_lenfixes reverse iteration in that case. Forward does the same skip now too.Test plan
.rev(), partial lists,iter_from().rev(), mixednext/next_back, pending push, updatesIterRev/IterFromRev