diff --git a/src/interned.rs b/src/interned.rs index 94a6d896..0c6d32cd 100644 --- a/src/interned.rs +++ b/src/interned.rs @@ -360,6 +360,22 @@ where } } +impl<'a, T> Lookup> for &'a T +where + T: ?Sized + Hash + Eq, + Box: From<&'a T>, +{ + fn hash(&self, h: &mut H) { + Hash::hash(self, &mut *h) + } + fn eq(&self, data: &Box) -> bool { + **self == **data + } + fn into_owned(self) -> Box { + Box::from(self) + } +} + impl Lookup for &str { fn hash(&self, h: &mut H) { Hash::hash(self, &mut *h)