Skip to content

Add reusable zipper buffers - #65

Open
imlvts wants to merge 1 commit into
Adam-Vandervorst:masterfrom
imlvts:zipper-buffer-reuse
Open

Add reusable zipper buffers#65
imlvts wants to merge 1 commit into
Adam-Vandervorst:masterfrom
imlvts:zipper-buffer-reuse

Conversation

@imlvts

@imlvts imlvts commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

This introduces ZipperBuffer. This allows re-using zipper path and stack Vecs.
Name up for change, don't have a strong preference.

fn ReadZipper::detach(self) -> ZipperBuffer; // saves path
fn ZipperBuffer::attach(self, &map) -> ReadZipper; // restores path
fn ReadZipper::relocate(self, &map) -> ReadZipper; // same path on a different map

detach + attach, relocate preserve the path. might need to change the API so this is explicit.

A few additional non-public API changes to make it work.
descend_to_byte used instead of descend_to to avoid aliased &mut.

@adamv-symbolica

Copy link
Copy Markdown

Nice! I quite like the API and naming.
The ancestor_node thing is a little ugly, but the lifetime tagging makes sense.
What's the motivation for going for a new object, rather than just a "disabled RZ" which is a zero-overhead opaque-type wrapper of a RZ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants