Skip to content

Commit 563f3de

Browse files
committed
---
yaml --- r: 187107 b: refs/heads/try c: bc09c1d h: refs/heads/master i: 187105: 9765b0e 187103: 4a0a8fc v: v3
1 parent 6cbc5e4 commit 563f3de

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 54f0bead8158eaf948c93d1cae93b60978937417
5+
refs/heads/try: bc09c1ddc5604642926428d69f2ebd7557b3230b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libcore/str/mod.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -931,29 +931,43 @@ impl Searcher {
931931
}
932932
}
933933

934-
/// An iterator over the start and end indices of the matches of a
935-
/// substring within a larger string
936934
#[derive(Clone)]
937935
#[unstable(feature = "core", reason = "type may be removed")]
938-
pub struct MatchIndices<'a> {
936+
struct OldMatchIndices<'a> {
939937
// constants
940938
haystack: &'a str,
941939
needle: &'a str,
942940
searcher: Searcher
943941
}
944942

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+
945959
/// An iterator over the substrings of a string separated by a given
946960
/// search string
947961
#[derive(Clone)]
948962
#[unstable(feature = "core", reason = "type may be removed")]
949963
pub struct SplitStr<'a> {
950-
it: MatchIndices<'a>,
964+
it: OldMatchIndices<'a>,
951965
last_end: uint,
952966
finished: bool
953967
}
954968

955969
#[stable(feature = "rust1", since = "1.0.0")]
956-
impl<'a> Iterator for MatchIndices<'a> {
970+
impl<'a> Iterator for OldMatchIndices<'a> {
957971
type Item = (uint, uint);
958972

959973
#[inline]
@@ -1465,17 +1479,17 @@ impl StrExt for str {
14651479

14661480
#[inline]
14671481
fn match_indices<'a>(&'a self, sep: &'a str) -> MatchIndices<'a> {
1468-
MatchIndices {
1482+
MatchIndices(OldMatchIndices {
14691483
haystack: self,
14701484
needle: sep,
14711485
searcher: Searcher::new(self.as_bytes(), sep.as_bytes())
1472-
}
1486+
})
14731487
}
14741488

14751489
#[inline]
14761490
fn split_str<'a>(&'a self, sep: &'a str) -> SplitStr<'a> {
14771491
SplitStr {
1478-
it: self.match_indices(sep),
1492+
it: self.match_indices(sep).0,
14791493
last_end: 0,
14801494
finished: false
14811495
}

branches/try/src/libcore/str/pattern.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ impl<'a, C: CharEq> DoubleEndedMatcher<'a> for CharEqMatcher<'a, C> {}
8484

8585
// Impl for &str
8686

87-
struct StrMatcher<'a>(super::MatchIndices<'a>);
87+
struct StrMatcher<'a>(super::OldMatchIndices<'a>);
8888

8989
impl<'a> Pattern<'a> for &'a str {
9090
type Matcher = StrMatcher<'a>;
9191

9292
#[inline]
9393
fn into_matcher(self, haystack: &'a str) -> StrMatcher<'a> {
94-
let mi = super::MatchIndices {
94+
let mi = super::OldMatchIndices {
9595
haystack: haystack,
9696
needle: self,
9797
searcher: super::Searcher::new(haystack.as_bytes(), self.as_bytes())

0 commit comments

Comments
 (0)