I want to have a very generic top-level HashMap.
static mut cache: HashMap<std::hash::Hash + Eq, MyBox<_>> = HashMap::new();
MyBox is a smart pointer.
I get all these errors:
the placeholder
_
is not allowed within types on item signatures for static variables
only auto traits can be used as additional traits in a trait object
help: consider creating a new trait with all of these as supertraits and using that trait here instead:trait NewTrait: Hash + Eq {}
the trait
Eq
cannot be made into an object
And also a warning "trait objects without an explicit dyn
are deprecated"
How can I create a static mut
HashMap that allows any keys and any boxed values?