1
Fork 0

Switched over a bunch of splitting funktions to non-allocating iterators

This commit is contained in:
Marvin Löbel 2013-03-24 07:51:18 +01:00
parent d74606ead6
commit b9de2b5787
13 changed files with 135 additions and 98 deletions

View file

@ -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