How can I model a bidirectional map without annoying the borrow checker?
问题 From Why can't I store a value and a reference to that value in the same struct? I learned that I cannot store a value and a reference in the same struct. The proposed solution is: The easiest and most recommended solution is to not attempt to put these items in the same structure together. By doing this, your structure nesting will mimic the lifetimes of your code. Place types that own data into a structure together and then provide methods that allow you to get references or objects