|
14 | 14 |
|
15 | 15 | use core::prelude::*; |
16 | 16 |
|
| 17 | +use core::iterator::IteratorUtil; |
17 | 18 | use core::cmp::Eq; |
18 | 19 | use core::io::{Reader, ReaderUtil}; |
19 | 20 | use core::io; |
@@ -358,7 +359,7 @@ pub fn query_to_str(query: &Query) -> ~str { |
358 | 359 |
|
359 | 360 | // returns the scheme and the rest of the url, or a parsing error |
360 | 361 | pub fn get_scheme(rawurl: &str) -> Result<(~str, ~str), ~str> { |
361 | | - for str::each_chari(rawurl) |i,c| { |
| 362 | + for rawurl.iter().enumerate().advance |(i,c)| { |
362 | 363 | match c { |
363 | 364 | 'A' .. 'Z' | 'a' .. 'z' => loop, |
364 | 365 | '0' .. '9' | '+' | '-' | '.' => { |
@@ -418,7 +419,7 @@ fn get_authority(rawurl: &str) -> |
418 | 419 | let mut colon_count = 0; |
419 | 420 | let mut (pos, begin, end) = (0, 2, len); |
420 | 421 |
|
421 | | - for str::each_chari(rawurl) |i,c| { |
| 422 | + for rawurl.iter().enumerate().advance |(i,c)| { |
422 | 423 | if i < 2 { loop; } // ignore the leading // |
423 | 424 |
|
424 | 425 | // deal with input class first |
@@ -562,7 +563,7 @@ fn get_path(rawurl: &str, authority: bool) -> |
562 | 563 | Result<(~str, ~str), ~str> { |
563 | 564 | let len = str::len(rawurl); |
564 | 565 | let mut end = len; |
565 | | - for str::each_chari(rawurl) |i,c| { |
| 566 | + for rawurl.iter().enumerate().advance |(i,c)| { |
566 | 567 | match c { |
567 | 568 | 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.' |
568 | 569 | | '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '=' |
|
0 commit comments