@@ -1041,21 +1041,18 @@ mod tests {
1041
1041
assert_eq ! ( de. read, vec![ ] ) ;
1042
1042
assert_eq ! ( de. write, vec![ ] ) ;
1043
1043
1044
- assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: borrowed_name( "root" ) ) ) ;
1045
- assert_eq ! (
1046
- de. peek( ) . unwrap( ) ,
1047
- & Start ( BytesStart :: borrowed_name( "inner" ) )
1048
- ) ;
1044
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new( "root" ) ) ) ;
1045
+ assert_eq ! ( de. peek( ) . unwrap( ) , & Start ( BytesStart :: new( "inner" ) ) ) ;
1049
1046
1050
1047
// Should skip first <inner> tree
1051
1048
de. skip ( ) . unwrap ( ) ;
1052
1049
assert_eq ! ( de. read, vec![ ] ) ;
1053
1050
assert_eq ! (
1054
1051
de. write,
1055
1052
vec![
1056
- Start ( BytesStart :: borrowed_name ( "inner" ) ) ,
1053
+ Start ( BytesStart :: new ( "inner" ) ) ,
1057
1054
Text ( BytesText :: from_escaped_str( "text" ) ) ,
1058
- Start ( BytesStart :: borrowed_name ( "inner" ) ) ,
1055
+ Start ( BytesStart :: new ( "inner" ) ) ,
1059
1056
End ( BytesEnd :: borrowed( "inner" ) ) ,
1060
1057
End ( BytesEnd :: borrowed( "inner" ) ) ,
1061
1058
]
@@ -1069,7 +1066,7 @@ mod tests {
1069
1066
// </inner>
1070
1067
// <target/>
1071
1068
// </root>
1072
- assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: borrowed_name ( "next" ) ) ) ;
1069
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new ( "next" ) ) ) ;
1073
1070
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "next" ) ) ) ;
1074
1071
1075
1072
// We finish writing. Next call to `next()` should start replay that messages:
@@ -1087,25 +1084,22 @@ mod tests {
1087
1084
assert_eq ! (
1088
1085
de. read,
1089
1086
vec![
1090
- Start ( BytesStart :: borrowed_name ( "inner" ) ) ,
1087
+ Start ( BytesStart :: new ( "inner" ) ) ,
1091
1088
Text ( BytesText :: from_escaped_str( "text" ) ) ,
1092
- Start ( BytesStart :: borrowed_name ( "inner" ) ) ,
1089
+ Start ( BytesStart :: new ( "inner" ) ) ,
1093
1090
End ( BytesEnd :: borrowed( "inner" ) ) ,
1094
1091
End ( BytesEnd :: borrowed( "inner" ) ) ,
1095
1092
]
1096
1093
) ;
1097
1094
assert_eq ! ( de. write, vec![ ] ) ;
1098
- assert_eq ! (
1099
- de. next( ) . unwrap( ) ,
1100
- Start ( BytesStart :: borrowed_name( "inner" ) )
1101
- ) ;
1095
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new( "inner" ) ) ) ;
1102
1096
1103
1097
// Skip `#text` node and consume <inner/> after it
1104
1098
de. skip ( ) . unwrap ( ) ;
1105
1099
assert_eq ! (
1106
1100
de. read,
1107
1101
vec![
1108
- Start ( BytesStart :: borrowed_name ( "inner" ) ) ,
1102
+ Start ( BytesStart :: new ( "inner" ) ) ,
1109
1103
End ( BytesEnd :: borrowed( "inner" ) ) ,
1110
1104
End ( BytesEnd :: borrowed( "inner" ) ) ,
1111
1105
]
@@ -1119,10 +1113,7 @@ mod tests {
1119
1113
]
1120
1114
) ;
1121
1115
1122
- assert_eq ! (
1123
- de. next( ) . unwrap( ) ,
1124
- Start ( BytesStart :: borrowed_name( "inner" ) )
1125
- ) ;
1116
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new( "inner" ) ) ) ;
1126
1117
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "inner" ) ) ) ;
1127
1118
1128
1119
// We finish writing. Next call to `next()` should start replay messages:
@@ -1148,10 +1139,7 @@ mod tests {
1148
1139
Text ( BytesText :: from_escaped_str( "text" ) )
1149
1140
) ;
1150
1141
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "inner" ) ) ) ;
1151
- assert_eq ! (
1152
- de. next( ) . unwrap( ) ,
1153
- Start ( BytesStart :: borrowed_name( "target" ) )
1154
- ) ;
1142
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new( "target" ) ) ) ;
1155
1143
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "target" ) ) ) ;
1156
1144
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "root" ) ) ) ;
1157
1145
}
@@ -1177,17 +1165,17 @@ mod tests {
1177
1165
assert_eq ! ( de. read, vec![ ] ) ;
1178
1166
assert_eq ! ( de. write, vec![ ] ) ;
1179
1167
1180
- assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: borrowed_name ( "root" ) ) ) ;
1168
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new ( "root" ) ) ) ;
1181
1169
1182
1170
// Skip the <skip> tree
1183
1171
de. skip ( ) . unwrap ( ) ;
1184
1172
assert_eq ! ( de. read, vec![ ] ) ;
1185
1173
assert_eq ! (
1186
1174
de. write,
1187
1175
vec![
1188
- Start ( BytesStart :: borrowed_name ( "skip" ) ) ,
1176
+ Start ( BytesStart :: new ( "skip" ) ) ,
1189
1177
Text ( BytesText :: from_escaped_str( "text" ) ) ,
1190
- Start ( BytesStart :: borrowed_name ( "skip" ) ) ,
1178
+ Start ( BytesStart :: new ( "skip" ) ) ,
1191
1179
End ( BytesEnd :: borrowed( "skip" ) ) ,
1192
1180
End ( BytesEnd :: borrowed( "skip" ) ) ,
1193
1181
]
@@ -1200,18 +1188,15 @@ mod tests {
1200
1188
// <skip/>
1201
1189
// </skip>
1202
1190
// </root>
1203
- assert_eq ! (
1204
- de. next( ) . unwrap( ) ,
1205
- Start ( BytesStart :: borrowed_name( "target" ) )
1206
- ) ;
1191
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new( "target" ) ) ) ;
1207
1192
de. read_to_end ( QName ( b"target" ) ) . unwrap ( ) ;
1208
1193
assert_eq ! ( de. read, vec![ ] ) ;
1209
1194
assert_eq ! (
1210
1195
de. write,
1211
1196
vec![
1212
- Start ( BytesStart :: borrowed_name ( "skip" ) ) ,
1197
+ Start ( BytesStart :: new ( "skip" ) ) ,
1213
1198
Text ( BytesText :: from_escaped_str( "text" ) ) ,
1214
- Start ( BytesStart :: borrowed_name ( "skip" ) ) ,
1199
+ Start ( BytesStart :: new ( "skip" ) ) ,
1215
1200
End ( BytesEnd :: borrowed( "skip" ) ) ,
1216
1201
End ( BytesEnd :: borrowed( "skip" ) ) ,
1217
1202
]
@@ -1231,16 +1216,16 @@ mod tests {
1231
1216
assert_eq ! (
1232
1217
de. read,
1233
1218
vec![
1234
- Start ( BytesStart :: borrowed_name ( "skip" ) ) ,
1219
+ Start ( BytesStart :: new ( "skip" ) ) ,
1235
1220
Text ( BytesText :: from_escaped_str( "text" ) ) ,
1236
- Start ( BytesStart :: borrowed_name ( "skip" ) ) ,
1221
+ Start ( BytesStart :: new ( "skip" ) ) ,
1237
1222
End ( BytesEnd :: borrowed( "skip" ) ) ,
1238
1223
End ( BytesEnd :: borrowed( "skip" ) ) ,
1239
1224
]
1240
1225
) ;
1241
1226
assert_eq ! ( de. write, vec![ ] ) ;
1242
1227
1243
- assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: borrowed_name ( "skip" ) ) ) ;
1228
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new ( "skip" ) ) ) ;
1244
1229
de. read_to_end ( QName ( b"skip" ) ) . unwrap ( ) ;
1245
1230
1246
1231
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "root" ) ) ) ;
@@ -1293,25 +1278,22 @@ mod tests {
1293
1278
"# ,
1294
1279
) ;
1295
1280
1296
- assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: borrowed_name ( "root" ) ) ) ;
1281
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new ( "root" ) ) ) ;
1297
1282
1298
1283
assert_eq ! (
1299
1284
de. next( ) . unwrap( ) ,
1300
- Start ( BytesStart :: borrowed ( r#"tag a="1""# , 3 ) )
1285
+ Start ( BytesStart :: from_content ( r#"tag a="1""# , 3 ) )
1301
1286
) ;
1302
1287
assert_eq ! ( de. read_to_end( QName ( b"tag" ) ) . unwrap( ) , ( ) ) ;
1303
1288
1304
1289
assert_eq ! (
1305
1290
de. next( ) . unwrap( ) ,
1306
- Start ( BytesStart :: borrowed ( r#"tag a="2""# , 3 ) )
1291
+ Start ( BytesStart :: from_content ( r#"tag a="2""# , 3 ) )
1307
1292
) ;
1308
1293
assert_eq ! ( de. next( ) . unwrap( ) , CData ( BytesCData :: new( "cdata content" ) ) ) ;
1309
1294
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "tag" ) ) ) ;
1310
1295
1311
- assert_eq ! (
1312
- de. next( ) . unwrap( ) ,
1313
- Start ( BytesStart :: borrowed_name( "self-closed" ) )
1314
- ) ;
1296
+ assert_eq ! ( de. next( ) . unwrap( ) , Start ( BytesStart :: new( "self-closed" ) ) ) ;
1315
1297
assert_eq ! ( de. read_to_end( QName ( b"self-closed" ) ) . unwrap( ) , ( ) ) ;
1316
1298
1317
1299
assert_eq ! ( de. next( ) . unwrap( ) , End ( BytesEnd :: borrowed( "root" ) ) ) ;
@@ -1382,17 +1364,17 @@ mod tests {
1382
1364
assert_eq ! (
1383
1365
events,
1384
1366
vec![
1385
- Start ( BytesStart :: borrowed (
1367
+ Start ( BytesStart :: from_content (
1386
1368
r#"item name="hello" source="world.rs""# ,
1387
1369
4
1388
1370
) ) ,
1389
1371
Text ( BytesText :: from_escaped_str( "Some text" ) ) ,
1390
1372
End ( BytesEnd :: borrowed( "item" ) ) ,
1391
- Start ( BytesStart :: borrowed ( "item2" , 5 ) ) ,
1373
+ Start ( BytesStart :: from_content ( "item2" , 5 ) ) ,
1392
1374
End ( BytesEnd :: borrowed( "item2" ) ) ,
1393
- Start ( BytesStart :: borrowed ( "item3" , 5 ) ) ,
1375
+ Start ( BytesStart :: from_content ( "item3" , 5 ) ) ,
1394
1376
End ( BytesEnd :: borrowed( "item3" ) ) ,
1395
- Start ( BytesStart :: borrowed ( r#"item4 value="world" "# , 5 ) ) ,
1377
+ Start ( BytesStart :: from_content ( r#"item4 value="world" "# , 5 ) ) ,
1396
1378
End ( BytesEnd :: borrowed( "item4" ) ) ,
1397
1379
]
1398
1380
)
@@ -1413,7 +1395,7 @@ mod tests {
1413
1395
1414
1396
assert_eq ! (
1415
1397
reader. next( ) . unwrap( ) ,
1416
- DeEvent :: Start ( BytesStart :: borrowed ( "item " , 4 ) )
1398
+ DeEvent :: Start ( BytesStart :: from_content ( "item " , 4 ) )
1417
1399
) ;
1418
1400
reader. read_to_end ( QName ( b"item" ) ) . unwrap ( ) ;
1419
1401
assert_eq ! ( reader. next( ) . unwrap( ) , DeEvent :: Eof ) ;
0 commit comments