about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-07 13:51:02 -0700
committerbors <bors@rust-lang.org>2013-09-07 13:51:02 -0700
commit7f8ada9acf128507106e67834c8d0d780f38636c (patch)
tree4d1803ab691b3b1d7e1325f3e8ac9ec83d607478
parent82b6ef66c22ac876cfc319eae7010648468919b9 (diff)
parent3eaf750a0de8acd5662d725b651e366fb703e5fa (diff)
downloadrust-7f8ada9acf128507106e67834c8d0d780f38636c.tar.gz
rust-7f8ada9acf128507106e67834c8d0d780f38636c.zip
auto merge of #9043 : sfackler/rust/uuid-from-bytes, r=alexcrichton
This method doesn't deal with utf8. I guess it got caught in a mass
rename.
-rw-r--r--src/libextra/uuid.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libextra/uuid.rs b/src/libextra/uuid.rs
index 9a79e61e233..b2c0f24824f 100644
--- a/src/libextra/uuid.rs
+++ b/src/libextra/uuid.rs
@@ -210,7 +210,7 @@ impl Uuid {
     ///
     /// # Arguments
     /// * `b` An array or slice of 16 bytes
-    pub fn from_utf8(b: &[u8]) -> Option<Uuid> {
+    pub fn from_bytes(b: &[u8]) -> Option<Uuid> {
         if b.len() != 16 {
             return None
         }
@@ -413,7 +413,7 @@ impl Uuid {
             ub[i] = FromStrRadix::from_str_radix(vs.slice(i*2, (i+1)*2), 16).unwrap();
         }
 
-        Ok(Uuid::from_utf8(ub).unwrap())
+        Ok(Uuid::from_bytes(ub).unwrap())
     }
 }
 
@@ -705,11 +705,11 @@ mod test {
     }
 
     #[test]
-    fn test_from_utf8() {
+    fn test_from_bytes() {
         let b = ~[ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
                    0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
 
-        let u = Uuid::from_utf8(b).unwrap();
+        let u = Uuid::from_bytes(b).unwrap();
         let expected = ~"a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8";
 
         assert!(u.to_simple_str() == expected);
@@ -729,7 +729,7 @@ mod test {
         let b_in: [u8, ..16] = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
                                  0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
 
-        let u = Uuid::from_utf8(b_in.clone()).unwrap();
+        let u = Uuid::from_bytes(b_in.clone()).unwrap();
 
         let b_out = u.to_bytes();