mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
HashCache: Apply trait bounds on type itself, rather than only the impl
I don't think there is any reason to keep the container more generic than its (only) implementation -- the constraints are necessary for this container to work at all. Defining the constraints on the type itself also enables use of #[derive(Debug)].
This commit is contained in:
parent
23b220644c
commit
3d078f7c64
1 changed files with 4 additions and 1 deletions
|
@ -12,7 +12,10 @@ use std::hash::{Hash, Hasher, SipHasher};
|
|||
use std::slice::Iter;
|
||||
|
||||
|
||||
pub struct HashCache<K, V> {
|
||||
pub struct HashCache<K, V>
|
||||
where K: Clone + PartialEq + Eq + Hash,
|
||||
V: Clone,
|
||||
{
|
||||
entries: HashMap<K, V, DefaultState<SipHasher>>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue