pub trait DynEntityId:
Any
+ Send
+ Sync
+ Debug {
// Required methods
fn dyn_hash(&self, state: &mut dyn Hasher);
fn dyn_eq(&self, other: &dyn DynEntityId) -> bool;
}Expand description
A dynamic identity type for our entities.
EntityId is mostly sufficient as a table name plus an Arc<dyn Any>.
But it needs some utility traits in order to accommodate our use cases,
and we can’t derive or manually implement them on their own precisely because
the relevant type has been erased.
This trait bridges the gap by providing dyn-compatible helpers. There’s a blanket impl for every possible valid type.
Required Methods§
Sourcefn dyn_hash(&self, state: &mut dyn Hasher)
fn dyn_hash(&self, state: &mut dyn Hasher)
dyn-compatible hash implementation. Prefer the normal hash implemenation where possible.
Sourcefn dyn_eq(&self, other: &dyn DynEntityId) -> bool
fn dyn_eq(&self, other: &dyn DynEntityId) -> bool
dyn-compatible equality implementation. Prefer the normal == implementation where possible.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".