@@ -63,7 +63,7 @@ impl PartialEq<Role> for Option<Role> {
63
63
}
64
64
65
65
/// Address identifying a PostgreSQL server uniquely.
66
- #[ derive( Clone , PartialEq , Hash , std :: cmp :: Eq , Debug ) ]
66
+ #[ derive( Clone , Debug ) ]
67
67
pub struct Address {
68
68
/// Unique ID per addressable Postgres server.
69
69
pub id : usize ,
@@ -121,6 +121,41 @@ impl Default for Address {
121
121
}
122
122
}
123
123
124
+ // We need to implement PartialEq by ourselves so we skip stats in the comparison
125
+ impl PartialEq for Address {
126
+ fn eq ( & self , other : & Self ) -> bool {
127
+ self . id == other. id
128
+ && self . host == other. host
129
+ && self . port == other. port
130
+ && self . shard == other. shard
131
+ && self . address_index == other. address_index
132
+ && self . replica_number == other. replica_number
133
+ && self . database == other. database
134
+ && self . role == other. role
135
+ && self . username == other. username
136
+ && self . pool_name == other. pool_name
137
+ && self . mirrors == other. mirrors
138
+ }
139
+ }
140
+ impl Eq for Address { }
141
+
142
+ // We need to implement Hash by ourselves so we skip stats in the comparison
143
+ impl Hash for Address {
144
+ fn hash < H : Hasher > ( & self , state : & mut H ) {
145
+ self . id . hash ( state) ;
146
+ self . host . hash ( state) ;
147
+ self . port . hash ( state) ;
148
+ self . shard . hash ( state) ;
149
+ self . address_index . hash ( state) ;
150
+ self . replica_number . hash ( state) ;
151
+ self . database . hash ( state) ;
152
+ self . role . hash ( state) ;
153
+ self . username . hash ( state) ;
154
+ self . pool_name . hash ( state) ;
155
+ self . mirrors . hash ( state) ;
156
+ }
157
+ }
158
+
124
159
impl Address {
125
160
/// Address name (aka database) used in `SHOW STATS`, `SHOW DATABASES`, and `SHOW POOLS`.
126
161
pub fn name ( & self ) -> String {
0 commit comments