I'm messing around with some memory management stuff which basically amounts to a custom specialised GC for a particular data graph where nodes can have different types but share a
I need to keep a map like
DashMap<*const (), u32> or
DashMap<*const dyn Node, u32> to track the reference counts of the small subset of nodes that are roots. The important points here are that we're keyed on reference equality between pointers, and that they can point to different underlying types, which can even be
?Sized. These pointers won't overlap, so in the case of fat pointers I actually only need to store the address.
I'm having a surprising amount of trouble doing this neatly. The only way that I've found uses
ptr.to_raw_parts().0, which is an experimental nightly feature. Is there a better way?