cosmwasm_std/forward_ref.rs
1/// Given an implementation of `T == U`, implements:
2/// - `&T == U`
3/// - `T == &U`
4///
5/// We don't need to add `&T == &U` here because this is implemented automatically.
6#[macro_export]
7macro_rules! forward_ref_partial_eq {
8 ($t:ty, $u:ty) => {
9 // `&T == U`
10 impl<'a> PartialEq<$u> for &'a $t {
11 #[inline]
12 fn eq(&self, rhs: &$u) -> bool {
13 **self == *rhs // Implement via T == U
14 }
15 }
16
17 // `T == &U`
18 impl PartialEq<&$u> for $t {
19 #[inline]
20 fn eq(&self, rhs: &&$u) -> bool {
21 *self == **rhs // Implement via T == U
22 }
23 }
24 };
25}