3 ms·
> sadly note structures like trees are sadly quite common, in the type of code I write anyway. It is a bit of a niggle I have with Rust. Trees are no problem w
by worik 4y ago
> sadly note structures like trees are sadly quite common, in the type of code I write anyway. It is a bit of a niggle I have with Rust.
Trees are no problem with Rust
It is circular, rather than recursive, data structures that are troublesome
- rich_sasha 4y agoI had to use recursion to build a tree in AoC '22 day 7. I needed to have both a mutable stack of current tree nodes (`cwd` if you like) and the tree structure. Or equivalently a doubly-linked tree, where nodes point at their parent. It was a bit ugly. In C++ you just write it. I get why it's hard in Rust, just saying, it really does crop up.
- worik 4y agoYes. It is hard on garbage collection too, circular structures.