File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,25 @@ impl Display for User {
149
149
}
150
150
151
151
/// A structure that can either be a string or bytes
152
- #[ derive( Clone , Debug , PartialEq ) ]
152
+ #[ derive( Clone , Debug ) ]
153
153
pub ( crate ) enum StringOrBytes {
154
154
/// A string
155
155
String ( String ) ,
156
156
/// A byte string
157
157
Bytes ( Vec < u8 > ) ,
158
158
}
159
159
160
+ impl PartialEq for StringOrBytes {
161
+ fn eq ( & self , other : & Self ) -> bool {
162
+ match ( self , other) {
163
+ ( Self :: String ( s) , Self :: String ( o) ) => s == o,
164
+ ( Self :: String ( s) , Self :: Bytes ( o) ) => s. as_bytes ( ) == o,
165
+ ( Self :: Bytes ( s) , Self :: String ( o) ) => s == o. as_bytes ( ) ,
166
+ ( Self :: Bytes ( s) , Self :: Bytes ( o) ) => s == o,
167
+ }
168
+ }
169
+ }
170
+
160
171
impl Display for StringOrBytes {
161
172
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
162
173
match self {
You can’t perform that action at this time.
0 commit comments