Skip to content

Instantly share code, notes, and snippets.

// 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.