HashMap keyed by Rc<RefCell<..>>

If you are willing to hash by ADDRESS of Rc, rather than the value inside the RefCell, you can use the same technique as:

Instead of using Rc<RefCell> do

pub struct MyWrapper(Rc<RefCell<T>>);

then, using Hash based on address (not value) of Rc you can have "hashing on MyWrapper == hashing on address the Rc points to"

1 Like