identifiers: Add more PartialEq implementations

This commit is contained in:
Jonas Platte 2021-09-17 22:18:05 +02:00
parent ce947741cb
commit 206c25e7e7
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -235,6 +235,30 @@ macro_rules! opaque_identifier_common_impls {
} }
} }
impl PartialEq<$id> for Box<$id> {
fn eq(&self, other: &$id) -> bool {
self.as_str() == other.as_str()
}
}
impl PartialEq<&'_ $id> for Box<$id> {
fn eq(&self, other: &&$id) -> bool {
self.as_str() == other.as_str()
}
}
impl PartialEq<Box<$id>> for $id {
fn eq(&self, other: &Box<$id>) -> bool {
self.as_str() == other.as_str()
}
}
impl PartialEq<Box<$id>> for &'_ $id {
fn eq(&self, other: &Box<$id>) -> bool {
self.as_str() == other.as_str()
}
}
as_str_based_impls!($id); as_str_based_impls!($id);
partial_eq_string!($id); partial_eq_string!($id);
partial_eq_string!(Box<$id>); partial_eq_string!(Box<$id>);