identifiers: Add extra PartialEq implementations for owned ID types
This commit is contained in:
parent
d36157a57c
commit
5d8f6748e6
@ -282,6 +282,30 @@ fn expand_owned_id(id: &Ident, owned: &Ident) -> TokenStream {
|
|||||||
|
|
||||||
#partial_eq_string
|
#partial_eq_string
|
||||||
|
|
||||||
|
impl PartialEq<#id> for #owned {
|
||||||
|
fn eq(&self, other: &#id) -> bool {
|
||||||
|
AsRef::<#id>::as_ref(self) == other
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialEq<#owned> for #id {
|
||||||
|
fn eq(&self, other: &#owned) -> bool {
|
||||||
|
self == AsRef::<#id>::as_ref(other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialEq<&#id> for #owned {
|
||||||
|
fn eq(&self, other: &&#id) -> bool {
|
||||||
|
AsRef::<#id>::as_ref(self) == *other
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialEq<#owned> for &#id {
|
||||||
|
fn eq(&self, other: &#owned) -> bool {
|
||||||
|
*self == AsRef::<#id>::as_ref(other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialEq<Box<#id>> for #owned {
|
impl PartialEq<Box<#id>> for #owned {
|
||||||
fn eq(&self, other: &Box<#id>) -> bool {
|
fn eq(&self, other: &Box<#id>) -> bool {
|
||||||
AsRef::<#id>::as_ref(self) == AsRef::<#id>::as_ref(other)
|
AsRef::<#id>::as_ref(self) == AsRef::<#id>::as_ref(other)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user