@@ -15,7 +15,7 @@ use crate::{
1515 Uint128 ,
1616} ;
1717
18- use super :: conversion:: forward_try_from;
18+ use super :: conversion:: { forward_try_from, wrapped_int_to_primitive } ;
1919use super :: impl_int_serde;
2020use super :: num_consts:: NumConsts ;
2121
@@ -342,6 +342,10 @@ impl From<u8> for Uint64 {
342342 }
343343}
344344
345+ // Uint to uint
346+ wrapped_int_to_primitive ! ( Uint64 , u64 ) ;
347+ wrapped_int_to_primitive ! ( Uint64 , u128 ) ;
348+
345349// Int to Uint
346350forward_try_from ! ( Int64 , Uint64 ) ;
347351forward_try_from ! ( Int128 , Uint64 ) ;
@@ -365,12 +369,6 @@ impl From<Uint64> for String {
365369 }
366370}
367371
368- impl From < Uint64 > for u64 {
369- fn from ( original : Uint64 ) -> Self {
370- original. 0
371- }
372- }
373-
374372impl fmt:: Display for Uint64 {
375373 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
376374 self . 0 . fmt ( f)
@@ -599,6 +597,10 @@ mod tests {
599597 let a = u64:: from ( original) ;
600598 assert_eq ! ( a, 12345 ) ;
601599
600+ let original = Uint64 ( 12345 ) ;
601+ let a = u128:: from ( original) ;
602+ assert_eq ! ( a, 12345 ) ;
603+
602604 let original = Uint64 ( 12345 ) ;
603605 let a = String :: from ( original) ;
604606 assert_eq ! ( a, "12345" ) ;
0 commit comments