From: Bennet Bleßmann Date: Sat, 3 Aug 2024 20:41:02 +0000 (+0200) Subject: impl PartialEq and PartialEq<&str> for Atom X-Git-Tag: v0.10.0~123^2~5 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=17a816eff424d96b9c3b14b3e34ed8fae9a793d6;p=scryer-prolog.git impl PartialEq and PartialEq<&str> for Atom --- diff --git a/src/atom_table.rs b/src/atom_table.rs index 4a426cd0..ea3a3a78 100644 --- a/src/atom_table.rs +++ b/src/atom_table.rs @@ -56,6 +56,18 @@ impl indexmap::Equivalent for str { } } +impl PartialEq 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;