Switched over a bunch of splitting funktions to non-allocating iterators
This commit is contained in:
parent
d74606ead6
commit
b9de2b5787
13 changed files with 135 additions and 98 deletions
|
@ -197,7 +197,9 @@ pub mod v4 {
|
|||
}
|
||||
}
|
||||
pub fn parse_to_ipv4_rep(ip: &str) -> result::Result<Ipv4Rep, ~str> {
|
||||
let parts = vec::map(str::split_char(ip, '.'), |s| {
|
||||
let mut parts = ~[];
|
||||
for str::each_split_char(ip, '.') |s| { parts.push(s.to_owned()) }
|
||||
let parts = vec::map(parts, |s| {
|
||||
match uint::from_str(*s) {
|
||||
Some(n) if n <= 255 => n,
|
||||
_ => 256
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue