@@ -1095,6 +1095,46 @@ impl From<&CStr> for CString {
1095
1095
}
1096
1096
}
1097
1097
1098
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1099
+ impl PartialEq < CStr > for CString {
1100
+ #[ inline]
1101
+ fn eq ( & self , other : & CStr ) -> bool {
1102
+ * * self == * other
1103
+ }
1104
+
1105
+ #[ inline]
1106
+ fn ne ( & self , other : & CStr ) -> bool {
1107
+ * * self != * other
1108
+ }
1109
+ }
1110
+
1111
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1112
+ impl PartialEq < & CStr > for CString {
1113
+ #[ inline]
1114
+ fn eq ( & self , other : & & CStr ) -> bool {
1115
+ * * self == * * other
1116
+ }
1117
+
1118
+ #[ inline]
1119
+ fn ne ( & self , other : & & CStr ) -> bool {
1120
+ * * self != * * other
1121
+ }
1122
+ }
1123
+
1124
+ #[ cfg( not( no_global_oom_handling) ) ]
1125
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1126
+ impl PartialEq < Cow < ' _ , CStr > > for CString {
1127
+ #[ inline]
1128
+ fn eq ( & self , other : & Cow < ' _ , CStr > ) -> bool {
1129
+ * * self == * * other
1130
+ }
1131
+
1132
+ #[ inline]
1133
+ fn ne ( & self , other : & Cow < ' _ , CStr > ) -> bool {
1134
+ * * self != * * other
1135
+ }
1136
+ }
1137
+
1098
1138
#[ stable( feature = "cstring_asref" , since = "1.7.0" ) ]
1099
1139
impl ops:: Index < ops:: RangeFull > for CString {
1100
1140
type Output = CStr ;
@@ -1178,6 +1218,75 @@ impl CStr {
1178
1218
}
1179
1219
}
1180
1220
1221
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1222
+ impl PartialEq < CString > for CStr {
1223
+ #[ inline]
1224
+ fn eq ( & self , other : & CString ) -> bool {
1225
+ * self == * * other
1226
+ }
1227
+
1228
+ #[ inline]
1229
+ fn ne ( & self , other : & CString ) -> bool {
1230
+ * self != * * other
1231
+ }
1232
+ }
1233
+
1234
+ #[ cfg( not( no_global_oom_handling) ) ]
1235
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1236
+ impl PartialEq < Cow < ' _ , Self > > for CStr {
1237
+ #[ inline]
1238
+ fn eq ( & self , other : & Cow < ' _ , Self > ) -> bool {
1239
+ * self == * * other
1240
+ }
1241
+
1242
+ #[ inline]
1243
+ fn ne ( & self , other : & Cow < ' _ , Self > ) -> bool {
1244
+ * self != * * other
1245
+ }
1246
+ }
1247
+
1248
+ #[ cfg( not( no_global_oom_handling) ) ]
1249
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1250
+ impl PartialEq < CStr > for Cow < ' _ , CStr > {
1251
+ #[ inline]
1252
+ fn eq ( & self , other : & CStr ) -> bool {
1253
+ * * self == * other
1254
+ }
1255
+
1256
+ #[ inline]
1257
+ fn ne ( & self , other : & CStr ) -> bool {
1258
+ * * self != * other
1259
+ }
1260
+ }
1261
+
1262
+ #[ cfg( not( no_global_oom_handling) ) ]
1263
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1264
+ impl PartialEq < & CStr > for Cow < ' _ , CStr > {
1265
+ #[ inline]
1266
+ fn eq ( & self , other : & & CStr ) -> bool {
1267
+ * * self == * * other
1268
+ }
1269
+
1270
+ #[ inline]
1271
+ fn ne ( & self , other : & & CStr ) -> bool {
1272
+ * * self != * * other
1273
+ }
1274
+ }
1275
+
1276
+ #[ cfg( not( no_global_oom_handling) ) ]
1277
+ #[ stable( feature = "c_string_eq_c_str" , since = "CURRENT_RUSTC_VERSION" ) ]
1278
+ impl PartialEq < CString > for Cow < ' _ , CStr > {
1279
+ #[ inline]
1280
+ fn eq ( & self , other : & CString ) -> bool {
1281
+ * * self == * * other
1282
+ }
1283
+
1284
+ #[ inline]
1285
+ fn ne ( & self , other : & CString ) -> bool {
1286
+ * * self != * * other
1287
+ }
1288
+ }
1289
+
1181
1290
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1182
1291
impl core:: error:: Error for NulError {
1183
1292
#[ allow( deprecated) ]
0 commit comments