Skip to content

Commit 7f8ada9

Browse files
committed
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.
2 parents 82b6ef6 + 3eaf750 commit 7f8ada9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libextra/uuid.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl Uuid {
210210
///
211211
/// # Arguments
212212
/// * `b` An array or slice of 16 bytes
213-
pub fn from_utf8(b: &[u8]) -> Option<Uuid> {
213+
pub fn from_bytes(b: &[u8]) -> Option<Uuid> {
214214
if b.len() != 16 {
215215
return None
216216
}
@@ -413,7 +413,7 @@ impl Uuid {
413413
ub[i] = FromStrRadix::from_str_radix(vs.slice(i*2, (i+1)*2), 16).unwrap();
414414
}
415415

416-
Ok(Uuid::from_utf8(ub).unwrap())
416+
Ok(Uuid::from_bytes(ub).unwrap())
417417
}
418418
}
419419

@@ -705,11 +705,11 @@ mod test {
705705
}
706706

707707
#[test]
708-
fn test_from_utf8() {
708+
fn test_from_bytes() {
709709
let b = ~[ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
710710
0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
711711

712-
let u = Uuid::from_utf8(b).unwrap();
712+
let u = Uuid::from_bytes(b).unwrap();
713713
let expected = ~"a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8";
714714

715715
assert!(u.to_simple_str() == expected);
@@ -729,7 +729,7 @@ mod test {
729729
let b_in: [u8, ..16] = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2,
730730
0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ];
731731

732-
let u = Uuid::from_utf8(b_in.clone()).unwrap();
732+
let u = Uuid::from_bytes(b_in.clone()).unwrap();
733733

734734
let b_out = u.to_bytes();
735735

0 commit comments

Comments
 (0)