about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAndreas Ots <andreasots@gmail.com>2013-11-25 07:55:58 +0200
committerAndreas Ots <andreasots@gmail.com>2013-11-25 08:44:04 +0200
commit20233b984855fa72adc07761a6c657ea191c1eb9 (patch)
treeff336bd410d8b92a67277370a9fc7ba1702854da /src/libstd
parent2cc1e16ac0ee1fe5ea07125215e2ee1d39e63c12 (diff)
downloadrust-20233b984855fa72adc07761a6c657ea191c1eb9.tar.gz
rust-20233b984855fa72adc07761a6c657ea191c1eb9.zip
std: IPv6 addresses are represented as eight groups of four HEXADECIMAL digits
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/net/ip.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs
index 9c63108beef..32c732b4fda 100644
--- a/src/libstd/io/net/ip.rs
+++ b/src/libstd/io/net/ip.rs
@@ -41,7 +41,7 @@ impl ToStr for IpAddr {
             }
 
             Ipv6Addr(a, b, c, d, e, f, g, h) =>
-                format!("{}:{}:{}:{}:{}:{}:{}:{}", a, b, c, d, e, f, g, h)
+                format!("{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}", a, b, c, d, e, f, g, h)
         }
     }
 }
@@ -449,6 +449,7 @@ mod test {
     fn ipv6_addr_to_str() {
         let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280);
         assert!(a1.to_str() == ~"::ffff:192.0.2.128" || a1.to_str() == ~"::FFFF:192.0.2.128");
+        assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), ~"8:9:a:b:c:d:e:f");
     }
 
 }