@@ -31,7 +31,7 @@ pub struct SecretKey([u8; constants::SECRET_KEY_SIZE]);
31
31
impl_array_newtype ! ( SecretKey , u8 , constants:: SECRET_KEY_SIZE ) ;
32
32
impl_pretty_debug ! ( SecretKey ) ;
33
33
34
- impl fmt:: Display for SecretKey {
34
+ impl fmt:: LowerHex for SecretKey {
35
35
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
36
36
for ch in & self . 0 [ ..] {
37
37
write ! ( f, "{:02x}" , * ch) ?;
@@ -40,6 +40,12 @@ impl fmt::Display for SecretKey {
40
40
}
41
41
}
42
42
43
+ impl fmt:: Display for SecretKey {
44
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
45
+ fmt:: LowerHex :: fmt ( self , f)
46
+ }
47
+ }
48
+
43
49
impl str:: FromStr for SecretKey {
44
50
type Err = Error ;
45
51
fn from_str ( s : & str ) -> Result < SecretKey , Error > {
@@ -61,7 +67,7 @@ pub const ONE_KEY: SecretKey = SecretKey([0, 0, 0, 0, 0, 0, 0, 0,
61
67
#[ derive( Copy , Clone , PartialEq , Eq , Debug , PartialOrd , Ord , Hash ) ]
62
68
pub struct PublicKey ( ffi:: PublicKey ) ;
63
69
64
- impl fmt:: Display for PublicKey {
70
+ impl fmt:: LowerHex for PublicKey {
65
71
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
66
72
let ser = self . serialize ( ) ;
67
73
for ch in & ser[ ..] {
@@ -71,6 +77,12 @@ impl fmt::Display for PublicKey {
71
77
}
72
78
}
73
79
80
+ impl fmt:: Display for PublicKey {
81
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
82
+ fmt:: LowerHex :: fmt ( self , f)
83
+ }
84
+ }
85
+
74
86
impl str:: FromStr for PublicKey {
75
87
type Err = Error ;
76
88
fn from_str ( s : & str ) -> Result < PublicKey , Error > {
0 commit comments