Closed RazrFalcon closed 6 years ago
What does "remove" mean that detach doesn't cover? Dropping items could be done with Tree<Option<T>>
or similar, but reclaiming storage in the Vec invalidates the entire tree.
Do'h. I missed it.
But what about values()
iter? It will return detached nodes anyway (it doesn't matter for my case, but still).
but reclaiming storage in the Vec invalidates the entire tree
You can store a list of free "nodes" so a new node will take a free space and will not expand the vector. But it will break the NodeId
.
Yeah Values
and Nodes
iterators can't really do anything about the structure of the tree.
Maintaining a free list really sounds like it would complicate the structure to the point where it would make sense to use a different tree representation.
I see. Then I'm closing it for now. I thought maybe this is a planned feature.
What about nodes remove support? I understand that with a current architecture it's not really possible because it will invalidate
NodeId
, but what if I really-really have to remove a node?UPD: I just noticed that you rewrote the whole thing...