id-tree
id-tree copied to clipboard
Mutable iterators
Would like to mutably iterate over node data. So far my attempts at adapting the immutable iterators runsinto E0495 problems. Maybe it will compile when the related pull request is merged.
My workaround for now is traversing over node ids: https://github.com/spearman/id-tree/tree/traverse-ids
I believe I've needed this before as well. I think I ended up dealing in NodeId
s just like you have above as my solution at that time, but it looks like I never added that to id-tree
(although I thought I had).
I'd be happy to accept a PR with those types of things implemented if you're willing to create one.
However, I'd like to also point you to an experimental tree implementation that I've been working on alongside id-tree
called slab-tree
.
There are several differences between the two projects, but one of them that you might care about is how you deal with Node
s and their relatives in slab-tree
. While I haven't actually written any of them yet, I believe these iterators (both mutable and immutable) should be much easier to implement in slab-tree
.
Please note: slab-tree
is currently not fully documented, and is only at v-0.1.3
. I do plan to keep working on it and publishing new versions, but I can't say for certain when I expect a 1.0
version to go live.
Thanks, opened a pull request. I'll keep an eye on slab-tree as well.