Commit 6e897d7
committed
Rollup merge of rust-lang#33849 - ranma42:escape-iters-count, r=alexcrichton
Implement `count` for `EscapeUnicode`
and cleanup the code for `count` for `EscapeDefault` (instead of repeating the `match` for `size_hint` and `count`).
This PR marks EscapeUnicode and EscapeDefault as ExactSizeIterator. The constraints for the trait implementations held even before this PR, but I am not sure if this is something we want to guarantee/expose (I would love feedback on this, especially on what would be the appropriate way to handle stabilisation, if needed).
Part of rust-lang#24214, split from rust-lang#31049.
The test for `count` was added in rust-lang#33103.2 files changed
+56
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
414 | 417 | | |
415 | 418 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
422 | 425 | | |
423 | 426 | | |
424 | 427 | | |
| |||
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
| 463 | + | |
460 | 464 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
| 465 | + | |
470 | 466 | | |
471 | 467 | | |
472 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
473 | 474 | | |
474 | 475 | | |
475 | 476 | | |
| |||
483 | 484 | | |
484 | 485 | | |
485 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
486 | 503 | | |
487 | 504 | | |
488 | 505 | | |
| |||
498 | 515 | | |
499 | 516 | | |
500 | 517 | | |
501 | | - | |
502 | | - | |
503 | 518 | | |
| 519 | + | |
| 520 | + | |
504 | 521 | | |
505 | 522 | | |
506 | 523 | | |
| |||
523 | 540 | | |
524 | 541 | | |
525 | 542 | | |
| 543 | + | |
526 | 544 | | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 545 | + | |
| 546 | + | |
533 | 547 | | |
534 | 548 | | |
| 549 | + | |
535 | 550 | | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 551 | + | |
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
| |||
578 | 588 | | |
579 | 589 | | |
580 | 590 | | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
581 | 603 | | |
582 | 604 | | |
583 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
279 | 285 | | |
280 | 286 | | |
281 | 287 | | |
| |||
0 commit comments