@@ -931,29 +931,43 @@ impl Searcher {
931
931
}
932
932
}
933
933
934
- /// An iterator over the start and end indices of the matches of a
935
- /// substring within a larger string
936
934
#[ derive( Clone ) ]
937
935
#[ unstable( feature = "core" , reason = "type may be removed" ) ]
938
- pub struct MatchIndices < ' a > {
936
+ struct OldMatchIndices < ' a > {
939
937
// constants
940
938
haystack : & ' a str ,
941
939
needle : & ' a str ,
942
940
searcher : Searcher
943
941
}
944
942
943
+ /// An iterator over the start and end indices of the matches of a
944
+ /// substring within a larger string
945
+ #[ derive( Clone ) ]
946
+ #[ unstable( feature = "core" , reason = "type may be removed" ) ]
947
+ pub struct MatchIndices < ' a > ( OldMatchIndices < ' a > ) ;
948
+
949
+ #[ stable]
950
+ impl < ' a > Iterator for MatchIndices < ' a > {
951
+ type Item = ( uint , uint ) ;
952
+
953
+ #[ inline]
954
+ fn next ( & mut self ) -> Option < ( uint , uint ) > {
955
+ self . 0 . next ( )
956
+ }
957
+ }
958
+
945
959
/// An iterator over the substrings of a string separated by a given
946
960
/// search string
947
961
#[ derive( Clone ) ]
948
962
#[ unstable( feature = "core" , reason = "type may be removed" ) ]
949
963
pub struct SplitStr < ' a > {
950
- it : MatchIndices < ' a > ,
964
+ it : OldMatchIndices < ' a > ,
951
965
last_end : uint ,
952
966
finished : bool
953
967
}
954
968
955
969
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
956
- impl < ' a > Iterator for MatchIndices < ' a > {
970
+ impl < ' a > Iterator for OldMatchIndices < ' a > {
957
971
type Item = ( uint , uint ) ;
958
972
959
973
#[ inline]
@@ -1465,17 +1479,17 @@ impl StrExt for str {
1465
1479
1466
1480
#[ inline]
1467
1481
fn match_indices < ' a > ( & ' a self , sep : & ' a str ) -> MatchIndices < ' a > {
1468
- MatchIndices {
1482
+ MatchIndices ( OldMatchIndices {
1469
1483
haystack : self ,
1470
1484
needle : sep,
1471
1485
searcher : Searcher :: new ( self . as_bytes ( ) , sep. as_bytes ( ) )
1472
- }
1486
+ } )
1473
1487
}
1474
1488
1475
1489
#[ inline]
1476
1490
fn split_str < ' a > ( & ' a self , sep : & ' a str ) -> SplitStr < ' a > {
1477
1491
SplitStr {
1478
- it : self . match_indices ( sep) ,
1492
+ it : self . match_indices ( sep) . 0 ,
1479
1493
last_end : 0 ,
1480
1494
finished : false
1481
1495
}
0 commit comments