This trait can be used to compare and hash trait objects. Based on and .
| 27 | /// and |
| 28 | /// <https://stackoverflow.com/questions/64838355/how-do-i-create-a-hashmap-with-type-erased-keys>. |
| 29 | pub trait DynEqHash { |
| 30 | fn as_any(&self) -> &dyn Any; |
| 31 | fn equals(&self, _: &dyn Any) -> bool; |
| 32 | fn hash(&self) -> u64; |
| 33 | } |
| 34 | |
| 35 | impl<T: 'static + Eq + Hash> DynEqHash for T { |
| 36 | fn as_any(&self) -> &dyn Any { |
nothing calls this directly
no outgoing calls
no test coverage detected