@@ -281,7 +281,7 @@ impl<'self, C: CharEq> CharEq for &'self [C] {
281
281
282
282
/// An iterator over the substrings of a string, separated by `sep`.
283
283
#[ deriving( Clone ) ]
284
- pub struct StrCharSplitIterator < ' self , Sep > {
284
+ pub struct CharSplitIterator < ' self , Sep > {
285
285
priv string : & ' self str ,
286
286
priv position : uint ,
287
287
priv sep: Sep ,
@@ -296,13 +296,13 @@ pub struct StrCharSplitIterator<'self,Sep> {
296
296
/// An iterator over the words of a string, separated by an sequence of whitespace
297
297
pub type WordIterator < ' self > =
298
298
FilterIterator < ' self , & ' self str ,
299
- StrCharSplitIterator < ' self , extern "Rust" fn ( char ) -> bool > > ;
299
+ CharSplitIterator < ' self , extern "Rust" fn ( char ) -> bool > > ;
300
300
301
301
/// An iterator over the lines of a string, separated by either `\n` or (`\r\n`).
302
302
pub type AnyLineIterator < ' self > =
303
- MapIterator < ' self , & ' self str , & ' self str , StrCharSplitIterator < ' self , char > > ;
303
+ MapIterator < ' self , & ' self str , & ' self str , CharSplitIterator < ' self , char > > ;
304
304
305
- impl < ' self , Sep : CharEq > Iterator < & ' self str > for StrCharSplitIterator < ' self , Sep > {
305
+ impl < ' self , Sep : CharEq > Iterator < & ' self str > for CharSplitIterator < ' self , Sep > {
306
306
#[ inline]
307
307
fn next ( & mut self ) -> Option < & ' self str > {
308
308
if self . finished { return None }
@@ -349,7 +349,7 @@ impl<'self, Sep: CharEq> Iterator<&'self str> for StrCharSplitIterator<'self, Se
349
349
/// An iterator over the start and end indicies of the matches of a
350
350
/// substring within a larger string
351
351
#[ deriving( Clone ) ]
352
- pub struct StrMatchesIndexIterator < ' self > {
352
+ pub struct MatchesIndexIterator < ' self > {
353
353
priv haystack : & ' self str ,
354
354
priv needle : & ' self str ,
355
355
priv position : uint ,
@@ -358,13 +358,13 @@ pub struct StrMatchesIndexIterator<'self> {
358
358
/// An iterator over the substrings of a string separated by a given
359
359
/// search string
360
360
#[ deriving( Clone ) ]
361
- pub struct StrStrSplitIterator < ' self > {
362
- priv it: StrMatchesIndexIterator < ' self > ,
361
+ pub struct StrSplitIterator < ' self > {
362
+ priv it: MatchesIndexIterator < ' self > ,
363
363
priv last_end : uint ,
364
364
priv finished : bool
365
365
}
366
366
367
- impl < ' self > Iterator < ( uint , uint ) > for StrMatchesIndexIterator < ' self > {
367
+ impl < ' self > Iterator < ( uint , uint ) > for MatchesIndexIterator < ' self > {
368
368
#[ inline]
369
369
fn next ( & mut self ) -> Option < ( uint , uint ) > {
370
370
// See Issue #1932 for why this is a naive search
@@ -395,7 +395,7 @@ impl<'self> Iterator<(uint, uint)> for StrMatchesIndexIterator<'self> {
395
395
}
396
396
}
397
397
398
- impl < ' self > Iterator < & ' self str > for StrStrSplitIterator < ' self > {
398
+ impl < ' self > Iterator < & ' self str > for StrSplitIterator < ' self > {
399
399
#[ inline]
400
400
fn next ( & mut self ) -> Option < & ' self str > {
401
401
if self . finished { return None ; }
@@ -1126,17 +1126,17 @@ impl Mutable for ~str {
1126
1126
pub trait StrSlice<'self> {
1127
1127
fn contains<'a>(&self, needle: &'a str) -> bool;
1128
1128
fn contains_char(&self, needle: char) -> bool;
1129
- fn iter(&self) -> StrCharIterator <'self>;
1130
- fn rev_iter(&self) -> StrCharRevIterator <'self>;
1131
- fn bytes_iter(&self) -> StrBytesIterator <'self>;
1132
- fn bytes_rev_iter(&self) -> StrBytesRevIterator <'self>;
1133
- fn split_iter<Sep: CharEq>(&self, sep: Sep) -> StrCharSplitIterator <'self, Sep>;
1134
- fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> StrCharSplitIterator <'self, Sep>;
1129
+ fn iter(&self) -> CharIterator <'self>;
1130
+ fn rev_iter(&self) -> CharRevIterator <'self>;
1131
+ fn bytes_iter(&self) -> BytesIterator <'self>;
1132
+ fn bytes_rev_iter(&self) -> BytesRevIterator <'self>;
1133
+ fn split_iter<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator <'self, Sep>;
1134
+ fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitIterator <'self, Sep>;
1135
1135
fn split_options_iter<Sep: CharEq>(&self, sep: Sep, count: uint, allow_trailing_empty: bool)
1136
- -> StrCharSplitIterator <'self, Sep>;
1137
- fn matches_index_iter(&self, sep: &'self str) -> StrMatchesIndexIterator <'self>;
1138
- fn split_str_iter(&self, &'self str) -> StrStrSplitIterator <'self>;
1139
- fn line_iter(&self) -> StrCharSplitIterator <'self, char>;
1136
+ -> CharSplitIterator <'self, Sep>;
1137
+ fn matches_index_iter(&self, sep: &'self str) -> MatchesIndexIterator <'self>;
1138
+ fn split_str_iter(&self, &'self str) -> StrSplitIterator <'self>;
1139
+ fn line_iter(&self) -> CharSplitIterator <'self, char>;
1140
1140
fn any_line_iter(&self) -> AnyLineIterator<'self>;
1141
1141
fn word_iter(&self) -> WordIterator<'self>;
1142
1142
fn ends_with(&self, needle: &str) -> bool;
@@ -1222,30 +1222,30 @@ impl<'self> StrSlice<'self> for &'self str {
1222
1222
/// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']);
1223
1223
/// ~~~
1224
1224
#[inline]
1225
- fn iter(&self) -> StrCharIterator <'self> {
1226
- StrCharIterator {
1225
+ fn iter(&self) -> CharIterator <'self> {
1226
+ CharIterator {
1227
1227
index: 0,
1228
1228
string: *self
1229
1229
}
1230
1230
}
1231
1231
/// An iterator over the characters of `self`, in reverse order.
1232
1232
#[inline]
1233
- fn rev_iter(&self) -> StrCharRevIterator <'self> {
1234
- StrCharRevIterator {
1233
+ fn rev_iter(&self) -> CharRevIterator <'self> {
1234
+ CharRevIterator {
1235
1235
index: self.len(),
1236
1236
string: *self
1237
1237
}
1238
1238
}
1239
1239
1240
1240
/// An iterator over the bytes of `self`
1241
1241
#[inline]
1242
- fn bytes_iter(&self) -> StrBytesIterator <'self> {
1243
- StrBytesIterator { it: self.as_bytes().iter() }
1242
+ fn bytes_iter(&self) -> BytesIterator <'self> {
1243
+ BytesIterator { it: self.as_bytes().iter() }
1244
1244
}
1245
1245
/// An iterator over the bytes of `self`, in reverse order
1246
1246
#[inline]
1247
- fn bytes_rev_iter(&self) -> StrBytesRevIterator <'self> {
1248
- StrBytesRevIterator { it: self.as_bytes().rev_iter() }
1247
+ fn bytes_rev_iter(&self) -> BytesRevIterator <'self> {
1248
+ BytesRevIterator { it: self.as_bytes().rev_iter() }
1249
1249
}
1250
1250
1251
1251
/// An iterator over substrings of `self`, separated by characters
@@ -1261,15 +1261,15 @@ impl<'self> StrSlice<'self> for &'self str {
1261
1261
/// assert_eq!(v, ~[" abc", " def", " ghi"]);
1262
1262
/// ~~~
1263
1263
#[inline]
1264
- fn split_iter<Sep: CharEq>(&self, sep: Sep) -> StrCharSplitIterator <'self, Sep> {
1264
+ fn split_iter<Sep: CharEq>(&self, sep: Sep) -> CharSplitIterator <'self, Sep> {
1265
1265
self.split_options_iter(sep, self.len(), true)
1266
1266
}
1267
1267
1268
1268
/// An iterator over substrings of `self`, separated by characters
1269
1269
/// matched by `sep`, restricted to splitting at most `count`
1270
1270
/// times.
1271
1271
#[inline]
1272
- fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> StrCharSplitIterator <'self, Sep> {
1272
+ fn splitn_iter<Sep: CharEq>(&self, sep: Sep, count: uint) -> CharSplitIterator <'self, Sep> {
1273
1273
self.split_options_iter(sep, count, true)
1274
1274
}
1275
1275
@@ -1279,9 +1279,9 @@ impl<'self> StrSlice<'self> for &'self str {
1279
1279
/// exists.
1280
1280
#[inline]
1281
1281
fn split_options_iter<Sep: CharEq>(&self, sep: Sep, count: uint, allow_trailing_empty: bool)
1282
- -> StrCharSplitIterator <'self, Sep> {
1282
+ -> CharSplitIterator <'self, Sep> {
1283
1283
let only_ascii = sep.only_ascii();
1284
- StrCharSplitIterator {
1284
+ CharSplitIterator {
1285
1285
string: *self,
1286
1286
position: 0,
1287
1287
sep: sep,
@@ -1294,9 +1294,9 @@ impl<'self> StrSlice<'self> for &'self str {
1294
1294
/// An iterator over the start and end indices of each match of
1295
1295
/// `sep` within `self`.
1296
1296
#[inline]
1297
- fn matches_index_iter(&self, sep: &'self str) -> StrMatchesIndexIterator <'self> {
1297
+ fn matches_index_iter(&self, sep: &'self str) -> MatchesIndexIterator <'self> {
1298
1298
assert!(!sep.is_empty())
1299
- StrMatchesIndexIterator {
1299
+ MatchesIndexIterator {
1300
1300
haystack: *self,
1301
1301
needle: sep,
1302
1302
position: 0
@@ -1313,8 +1313,8 @@ impl<'self> StrSlice<'self> for &'self str {
1313
1313
* ~~~
1314
1314
*/
1315
1315
#[inline]
1316
- fn split_str_iter(&self, sep: &'self str) -> StrStrSplitIterator <'self> {
1317
- StrStrSplitIterator {
1316
+ fn split_str_iter(&self, sep: &'self str) -> StrSplitIterator <'self> {
1317
+ StrSplitIterator {
1318
1318
it: self.matches_index_iter(sep),
1319
1319
last_end: 0,
1320
1320
finished: false
@@ -1324,7 +1324,7 @@ impl<'self> StrSlice<'self> for &'self str {
1324
1324
/// An iterator over the lines of a string (subsequences separated
1325
1325
/// by `\n `).
1326
1326
#[inline]
1327
- fn line_iter(&self) -> StrCharSplitIterator <'self, char> {
1327
+ fn line_iter(&self) -> CharSplitIterator <'self, char> {
1328
1328
self.split_options_iter('\n ', self.len(), false)
1329
1329
}
1330
1330
@@ -2253,12 +2253,12 @@ impl Clone for @str {
2253
2253
/// External iterator for a string's characters. Use with the `std::iterator`
2254
2254
/// module.
2255
2255
#[deriving(Clone)]
2256
- pub struct StrCharIterator <'self> {
2256
+ pub struct CharIterator <'self> {
2257
2257
priv index: uint,
2258
2258
priv string: &'self str,
2259
2259
}
2260
2260
2261
- impl<'self> Iterator<char> for StrCharIterator <'self> {
2261
+ impl<'self> Iterator<char> for CharIterator <'self> {
2262
2262
#[inline]
2263
2263
fn next(&mut self) -> Option<char> {
2264
2264
if self.index < self.string.len() {
@@ -2273,12 +2273,12 @@ impl<'self> Iterator<char> for StrCharIterator<'self> {
2273
2273
/// External iterator for a string's characters in reverse order. Use
2274
2274
/// with the `std::iterator` module.
2275
2275
#[deriving(Clone)]
2276
- pub struct StrCharRevIterator <'self> {
2276
+ pub struct CharRevIterator <'self> {
2277
2277
priv index: uint,
2278
2278
priv string: &'self str,
2279
2279
}
2280
2280
2281
- impl<'self> Iterator<char> for StrCharRevIterator <'self> {
2281
+ impl<'self> Iterator<char> for CharRevIterator <'self> {
2282
2282
#[inline]
2283
2283
fn next(&mut self) -> Option<char> {
2284
2284
if self.index > 0 {
@@ -2294,11 +2294,11 @@ impl<'self> Iterator<char> for StrCharRevIterator<'self> {
2294
2294
/// External iterator for a string's bytes. Use with the `std::iterator`
2295
2295
/// module.
2296
2296
#[deriving(Clone)]
2297
- pub struct StrBytesIterator <'self> {
2297
+ pub struct BytesIterator <'self> {
2298
2298
priv it: vec::VecIterator<'self, u8>
2299
2299
}
2300
2300
2301
- impl<'self> Iterator<u8> for StrBytesIterator <'self> {
2301
+ impl<'self> Iterator<u8> for BytesIterator <'self> {
2302
2302
#[inline]
2303
2303
fn next(&mut self) -> Option<u8> {
2304
2304
self.it.next().map_consume(|&x| x)
@@ -2308,11 +2308,11 @@ impl<'self> Iterator<u8> for StrBytesIterator<'self> {
2308
2308
/// External iterator for a string's bytes in reverse order. Use with
2309
2309
/// the `std::iterator` module.
2310
2310
#[deriving(Clone)]
2311
- pub struct StrBytesRevIterator <'self> {
2312
- priv it: vec::VecRevIterator <'self, u8>
2311
+ pub struct BytesRevIterator <'self> {
2312
+ priv it: vec::RevIterator <'self, u8>
2313
2313
}
2314
2314
2315
- impl<'self> Iterator<u8> for StrBytesRevIterator <'self> {
2315
+ impl<'self> Iterator<u8> for BytesRevIterator <'self> {
2316
2316
#[inline]
2317
2317
fn next(&mut self) -> Option<u8> {
2318
2318
self.it.next().map_consume(|&x| x)
0 commit comments