@@ -380,6 +380,7 @@ macro_rules! casemappingiter_impls {
380
380
#[ $fusedstab: meta]
381
381
#[ $exactstab: meta]
382
382
#[ $displaystab: meta]
383
+ #[ $partialstab: meta]
383
384
$( #[ $attr: meta] ) *
384
385
$ITER_NAME: ident
385
386
) => {
@@ -478,6 +479,38 @@ macro_rules! casemappingiter_impls {
478
479
fmt:: Display :: fmt( & self . 0 , f)
479
480
}
480
481
}
482
+
483
+ #[ $partialstab]
484
+ impl PartialEq <ToUppercase > for $ITER_NAME {
485
+ #[ inline]
486
+ fn eq( & self , other: & ToUppercase ) -> bool {
487
+ self . 0 == other. 0
488
+ }
489
+ }
490
+
491
+ #[ unstable( feature = "titlecase" , issue = "none" ) ]
492
+ impl PartialEq <ToTitlecase > for $ITER_NAME {
493
+ #[ inline]
494
+ fn eq( & self , other: & ToTitlecase ) -> bool {
495
+ self . 0 == other. 0
496
+ }
497
+ }
498
+
499
+ #[ $partialstab]
500
+ impl PartialEq <ToLowercase > for $ITER_NAME {
501
+ #[ inline]
502
+ fn eq( & self , other: & ToLowercase ) -> bool {
503
+ self . 0 == other. 0
504
+ }
505
+ }
506
+
507
+ #[ $partialstab]
508
+ impl PartialEq <char > for $ITER_NAME {
509
+ #[ inline]
510
+ fn eq( & self , other: & char ) -> bool {
511
+ self . 0 == * other
512
+ }
513
+ }
481
514
}
482
515
}
483
516
@@ -487,6 +520,7 @@ casemappingiter_impls! {
487
520
#[ stable( feature = "fused" , since = "1.26.0" ) ]
488
521
#[ stable( feature = "exact_size_case_mapping_iter" , since = "1.35.0" ) ]
489
522
#[ stable( feature = "char_struct_display" , since = "1.16.0" ) ]
523
+ #[ stable( feature = "iter_partialeq" , since = "CURRENT_RUSTC_VERSION" ) ]
490
524
/// Returns an iterator that yields the uppercase equivalent of a `char`.
491
525
///
492
526
/// This `struct` is created by the [`to_uppercase`] method on [`char`]. See
@@ -502,6 +536,7 @@ casemappingiter_impls! {
502
536
#[ unstable( feature = "titlecase" , issue = "none" ) ]
503
537
#[ unstable( feature = "titlecase" , issue = "none" ) ]
504
538
#[ unstable( feature = "titlecase" , issue = "none" ) ]
539
+ #[ unstable( feature = "titlecase" , issue = "none" ) ]
505
540
/// Returns an iterator that yields the titlecase equivalent of a `char`.
506
541
///
507
542
/// This `struct` is created by the [`to_titlecase`] method on [`char`]. See
@@ -517,6 +552,7 @@ casemappingiter_impls! {
517
552
#[ stable( feature = "fused" , since = "1.26.0" ) ]
518
553
#[ stable( feature = "exact_size_case_mapping_iter" , since = "1.35.0" ) ]
519
554
#[ stable( feature = "char_struct_display" , since = "1.16.0" ) ]
555
+ #[ stable( feature = "iter_partialeq" , since = "CURRENT_RUSTC_VERSION" ) ]
520
556
/// Returns an iterator that yields the lowercase equivalent of a `char`.
521
557
///
522
558
/// This `struct` is created by the [`to_lowercase`] method on [`char`]. See
@@ -632,6 +668,22 @@ impl fmt::Display for CaseMappingIter {
632
668
}
633
669
}
634
670
671
+ impl PartialEq for CaseMappingIter {
672
+ #[ inline]
673
+ fn eq ( & self , other : & Self ) -> bool {
674
+ self . 0 . as_slice ( ) == other. 0 . as_slice ( )
675
+ }
676
+ }
677
+
678
+ impl Eq for CaseMappingIter { }
679
+
680
+ impl PartialEq < char > for CaseMappingIter {
681
+ #[ inline]
682
+ fn eq ( & self , other : & char ) -> bool {
683
+ self . 0 . as_slice ( ) == & [ * other]
684
+ }
685
+ }
686
+
635
687
/// The error type returned when a checked char conversion fails.
636
688
#[ stable( feature = "u8_from_char" , since = "1.59.0" ) ]
637
689
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
0 commit comments