#[macro_export]
macro_rules! eq_trait_object {
($($path:tt)+) => {
$crate::__internal_eq_trait_object!(begin $($path)+);
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __internal_eq_trait_object {
(begin < $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(generics () () $($rest)*);
};
(begin $first:tt $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(path () ($first) $($rest)*);
};
(generics ($($generics:tt)*) () > $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(path ($($generics)*) () $($rest)*);
};
(generics ($($generics:tt)*) ($($brackets:tt)*) < $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(generics ($($generics)* <) ($($brackets)* <) $($rest)*);
};
(generics ($($generics:tt)*) (< $($brackets:tt)*) > $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(generics ($($generics)* >) ($($brackets)*) $($rest)*);
};
(generics ($($generics:tt)*) ($($brackets:tt)*) $first:tt $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(generics ($($generics)* $first) ($($brackets)*) $($rest)*);
};
(path ($($generics:tt)*) ($($path:tt)*) where $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(impl ($($generics)*) ($($path)*) ($($rest)*));
};
(path ($($generics:tt)*) ($($path:tt)*)) => {
$crate::__internal_eq_trait_object!(impl ($($generics)*) ($($path)*) ());
};
(path ($($generics:tt)*) ($($path:tt)*) $first:tt $($rest:tt)*) => {
$crate::__internal_eq_trait_object!(path ($($generics)*) ($($path)* $first) $($rest)*);
};
(impl ($($generics:tt)*) ($($path:tt)*) ($($bound:tt)*)) => {
impl<'eq, $($generics)*> ::core::cmp::PartialEq for (dyn $($path)* + 'eq) where $($bound)* {
fn eq(&self, other: &Self) -> bool {
self.dyn_eq(DynEq::as_any(other))
}
}
impl<'eq, $($generics)*> ::core::cmp::PartialEq for (dyn $($path)* + ::core::marker::Send + 'eq) where $($bound)* {
fn eq(&self, other: &Self) -> bool {
self.dyn_eq(DynEq::as_any(other))
}
}
impl<'eq, $($generics)*> ::core::cmp::PartialEq for (dyn $($path)* + ::core::marker::Sync + 'eq) where $($bound)* {
fn eq(&self, other: &Self) -> bool {
self.dyn_eq(DynEq::as_any(other))
}
}
impl<'eq, $($generics)*> ::core::cmp::PartialEq for (dyn $($path)* + ::core::marker::Send + ::core::marker::Sync + 'eq) where $($bound)* {
fn eq(&self, other: &Self) -> bool {
self.dyn_eq(DynEq::as_any(other))
}
}
$crate::__internal_eq_trait_object_alloc!(($($generics)*) ($($path)*) ($($bound)*));
impl<'eq, $($generics)*> ::core::cmp::Eq for (dyn $($path)* + 'eq) where $($bound)* {}
impl<'eq, $($generics)*> ::core::cmp::Eq for (dyn $($path)* + ::core::marker::Send + 'eq) where $($bound)* {}
impl<'eq, $($generics)*> ::core::cmp::Eq for (dyn $($path)* + ::core::marker::Sync + 'eq) where $($bound)* {}
impl<'eq, $($generics)*> ::core::cmp::Eq for (dyn $($path)* + ::core::marker::Send + ::core::marker::Sync + 'eq) where $($bound)* {}
};
}
#[cfg(feature = "alloc")]
#[doc(hidden)]
#[macro_export]
macro_rules! __internal_eq_trait_object_alloc {
(($($generics:tt)*) ($($path:tt)*) ($($bound:tt)*)) => {
impl<'eq, $($generics)*> ::core::cmp::PartialEq<&Self> for $crate::Box<dyn $($path)* + 'eq> where $($bound)* {
fn eq(&self, other: &&Self) -> bool {
self == *other
}
}
impl<'eq, $($generics)*> ::core::cmp::PartialEq<&Self> for $crate::Box<dyn $($path)* + ::core::marker::Send + 'eq> where $($bound)* {
fn eq(&self, other: &&Self) -> bool {
self == *other
}
}
impl<'eq, $($generics)*> ::core::cmp::PartialEq<&Self> for $crate::Box<dyn $($path)* + ::core::marker::Sync + 'eq> where $($bound)* {
fn eq(&self, other: &&Self) -> bool {
self == *other
}
}
impl<'eq, $($generics)*> ::core::cmp::PartialEq<&Self> for $crate::Box<dyn $($path)* + ::core::marker::Send + ::core::marker::Sync + 'eq> where $($bound)* {
fn eq(&self, other: &&Self) -> bool {
self == *other
}
}
}
}
#[cfg(not(feature = "alloc"))]
#[doc(hidden)]
#[macro_export]
macro_rules! __internal_eq_trait_object_alloc {
(($($generics:tt)*) ($($path:tt)*) ($($bound:tt)*)) => {};
}