]> Repositorios git - scryer-prolog.git/commitdiff
impl PartialEq<str> and PartialEq<&str> for Atom
authorBennet Bleßmann <[email protected]>
Sat, 3 Aug 2024 20:41:02 +0000 (22:41 +0200)
committerBennet Bleßmann <[email protected]>
Mon, 5 Aug 2024 19:25:42 +0000 (21:25 +0200)
src/atom_table.rs

index 4a426cd0cb049e1c6683ea568e5aa48ed146ae2b..ea3a3a782e25f04e77ce06e0d3fc5646b552a5b5 100644 (file)
@@ -56,6 +56,18 @@ impl indexmap::Equivalent<Atom> for str {
     }
 }
 
+impl PartialEq<str> for Atom {
+    fn eq(&self, other: &str) -> bool {
+        self.as_str().deref() == other
+    }
+}
+
+impl PartialEq<&str> for Atom {
+    fn eq(&self, &other: &&str) -> bool {
+        self.as_str().deref() == other
+    }
+}
+
 const ATOM_TABLE_INIT_SIZE: usize = 1 << 16;
 const ATOM_TABLE_ALIGN: usize = 8;