@@ -394,6 +394,13 @@ impl Iterator for ToLowercase {
394394 }
395395}
396396
397+ #[ stable( feature = "double_ended_case_mapping_iter" , since = "1.36.0" ) ]
398+ impl DoubleEndedIterator for ToLowercase {
399+ fn next_back ( & mut self ) -> Option < char > {
400+ self . 0 . next_back ( )
401+ }
402+ }
403+
397404#[ stable( feature = "fused" , since = "1.26.0" ) ]
398405impl FusedIterator for ToLowercase { }
399406
@@ -422,6 +429,13 @@ impl Iterator for ToUppercase {
422429 }
423430}
424431
432+ #[ stable( feature = "double_ended_case_mapping_iter" , since = "1.36.0" ) ]
433+ impl DoubleEndedIterator for ToUppercase {
434+ fn next_back ( & mut self ) -> Option < char > {
435+ self . 0 . next_back ( )
436+ }
437+ }
438+
425439#[ stable( feature = "fused" , since = "1.26.0" ) ]
426440impl FusedIterator for ToUppercase { }
427441
@@ -481,6 +495,26 @@ impl Iterator for CaseMappingIter {
481495 }
482496}
483497
498+ impl DoubleEndedIterator for CaseMappingIter {
499+ fn next_back ( & mut self ) -> Option < char > {
500+ match * self {
501+ CaseMappingIter :: Three ( a, b, c) => {
502+ * self = CaseMappingIter :: Two ( a, b) ;
503+ Some ( c)
504+ }
505+ CaseMappingIter :: Two ( a, b) => {
506+ * self = CaseMappingIter :: One ( a) ;
507+ Some ( b)
508+ }
509+ CaseMappingIter :: One ( a) => {
510+ * self = CaseMappingIter :: Zero ;
511+ Some ( a)
512+ }
513+ CaseMappingIter :: Zero => None ,
514+ }
515+ }
516+ }
517+
484518impl fmt:: Display for CaseMappingIter {
485519 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
486520 match * self {
0 commit comments