Skip to content

Refactor tree::peel_to_entry to make the intent more obvious#2492

Merged
Sebastian Thiel (Byron) merged 2 commits intoGitoxideLabs:mainfrom
datdenkikniet:peel_to_entry
Mar 30, 2026
Merged

Refactor tree::peel_to_entry to make the intent more obvious#2492
Sebastian Thiel (Byron) merged 2 commits intoGitoxideLabs:mainfrom
datdenkikniet:peel_to_entry

Conversation

@datdenkikniet
Copy link
Copy Markdown
Contributor

@datdenkikniet datdenkikniet commented Mar 26, 2026

To me the intent is clearer this way, and I don't think we do any more or less work than before. Even though self is a Tree, the find() calls can invalidate this already so tracking the data ID instead of the last tree ID felt odd.

The first commit is separate just to fix what I asked about in my comment in #2489. The MSRV check passes, so I think it's fine :D

Copy link
Copy Markdown
Member

@Byron Sebastian Thiel (Byron) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

I spent more time on this than I would have wanted to, and while I think the first commit is making it a little better, the second commit I disagree with. Generally, I prefer a version that won't change the state of the instance to anything that is not a tree if it can avoid it.

The slight awkwardness of the implementation probably also hints at the strange "tree really wants to reuse its own buffer to safe an allocation" premise.

@Byron Sebastian Thiel (Byron) merged commit a298901 into GitoxideLabs:main Mar 30, 2026
32 checks passed
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