This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // how can we do a tree in Rust, where each node | |
| // tells its children to update, and in turn, the | |
| // child may update the parent? | |
| // | |
| // The following example illustrates the technique. Notice how we | |
| // can't let the children have full backpointers to | |
| // parent nodes, and instead have to have them point | |
| // back to parent.data. Otherwise the two paths | |
| // (parent) and (parent->child) overlap, and modifying | |
| // parent could unsafely clobber (parent->child) use. |
NewerOlder