File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ use std::rand::Rng;
66
66
use std:: cmp:: Eq ;
67
67
use std:: cast:: { transmute, transmute_copy} ;
68
68
69
+ use serialize:: { Encoder , Encodable , Decoder , Decodable } ;
70
+
69
71
/// A 128-bit (16 byte) buffer containing the ID
70
72
pub type UuidBytes = [ u8 , ..16 ] ;
71
73
@@ -486,6 +488,19 @@ impl TotalEq for Uuid {
486
488
}
487
489
}
488
490
491
+ // FIXME #9845: Test these
492
+ impl < T : Encoder > Encodable < T > for Uuid {
493
+ fn encode ( & self , e : & mut T ) {
494
+ e. emit_str ( self . to_hyphenated_str ( ) ) ;
495
+ }
496
+ }
497
+
498
+ impl < T : Decoder > Decodable < T > for Uuid {
499
+ fn decode ( d : & mut T ) -> Uuid {
500
+ from_str ( d. read_str ( ) ) . unwrap ( )
501
+ }
502
+ }
503
+
489
504
/// Generates a random instance of UUID (V4 conformant)
490
505
impl rand:: Rand for Uuid {
491
506
#[ inline]
You can’t perform that action at this time.
0 commit comments