diff --git a/src/interned.rs b/src/interned.rs index 77dda42b7..544a8d0ee 100644 --- a/src/interned.rs +++ b/src/interned.rs @@ -1278,6 +1278,13 @@ impl Lookup for &str { } } +#[cfg(feature = "compact_str")] +impl Lookup for &str { + fn into_owned(self) -> compact_str::CompactString { + compact_str::CompactString::new(self) + } +} + impl HashEqLike<&str> for String { fn hash(&self, h: &mut H) { Hash::hash(self, &mut *h) @@ -1288,6 +1295,17 @@ impl HashEqLike<&str> for String { } } +#[cfg(feature = "compact_str")] +impl HashEqLike<&str> for compact_str::CompactString { + fn hash(&self, h: &mut H) { + Hash::hash(self, &mut *h) + } + + fn eq(&self, data: &&str) -> bool { + self == *data + } +} + impl> HashEqLike<&[A]> for Vec { fn hash(&self, h: &mut H) { Hash::hash(self, h);