From 17a816eff424d96b9c3b14b3e34ed8fae9a793d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bennet=20Ble=C3=9Fmann?= Date: Sat, 3 Aug 2024 22:41:02 +0200 Subject: [PATCH] impl PartialEq and PartialEq<&str> for Atom --- src/atom_table.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; -- 2.54.0