From 3d078f7c6420526d47bd50c06217b2feaab35cb2 Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Wed, 9 Dec 2015 19:29:11 +0100 Subject: [PATCH] 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)]. --- components/util/cache.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/util/cache.rs b/components/util/cache.rs index 7a3dcfa980f..2efb6a4e781 100644 --- a/components/util/cache.rs +++ b/components/util/cache.rs @@ -12,7 +12,10 @@ use std::hash::{Hash, Hasher, SipHasher}; use std::slice::Iter; -pub struct HashCache { +pub struct HashCache + where K: Clone + PartialEq + Eq + Hash, + V: Clone, +{ entries: HashMap>, }