We need a BTreeMap with some unusual properties:
- Having a child borrowed (mutably or immutably) shouldn't prevent adding/removing nodes on the parent, as long as such nodes aren't borrowed.
- To mutably borrow a child requires mutably borrowing the parent.
These are based on the following property of Rust structs:
// boilerplate let x = &mut a.x; let y = &mut a.y; // can use both x and y, since they're non-overlapping.
But how do you extend the idea of "non-overlapping" to heap-allocated collections? (Rust structs require you to define the struct at compile-time, so you can't just "add fields" to a borrowed struct. But there's no reason a heap-allocated collection should have the same limitations.