pub trait Key:
Clone
+ Debug
+ Eq
+ Hash
+ Ord
+ 'static { }Expand description
Store key.
This trait defines the basic requirements for a key used in a Store.
We can’t use specific traits bounds, e.g., Eq + Hash for hash maps
and Ord for ordered keys, since we would lose the ability to allow for
using Borrow to generalize the key type.
Keys must implement Clone, Debug, Eq, Hash and Ord, all
of which we consider reasonable requirements for a generic API.
Warning: The 'static lifetime which is required by this trait is a
deliberate design choice to simplify trait bounds across the code base. If
we would not require the lifetime, we would need to add a lifetime parameter
to almost all types using this trait, which makes it cumbersome to use.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.