Add PartialEq impls for comparison against specific atoms
diff --git a/syntax/atom.rs b/syntax/atom.rs
index 57325d8..903f561 100644
--- a/syntax/atom.rs
+++ b/syntax/atom.rs
@@ -1,3 +1,4 @@
+use crate::syntax::Type;
use proc_macro2::Ident;
#[derive(Copy, Clone, PartialEq)]
@@ -38,3 +39,18 @@
}
}
}
+
+impl PartialEq<Atom> for Ident {
+ fn eq(&self, atom: &Atom) -> bool {
+ Atom::from(self) == Some(*atom)
+ }
+}
+
+impl PartialEq<Atom> for Type {
+ fn eq(&self, atom: &Atom) -> bool {
+ match self {
+ Type::Ident(ident) => ident == atom,
+ _ => false,
+ }
+ }
+}