Add Display for PublicKey

This commit is contained in:
Age Manning 2019-03-29 00:43:53 +11:00
parent 9f53e71efd
commit 1e760d6719
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93

View File

@ -7,6 +7,7 @@ use ssz::{
decode_ssz_list, hash, ssz_encode, Decodable, DecodeError, Encodable, SszStream, TreeHash,
};
use std::default;
use std::fmt;
use std::hash::{Hash, Hasher};
/// A single BLS signature.
@ -54,6 +55,12 @@ impl PublicKey {
}
}
impl fmt::Display for PublicKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.concatenated_hex_id())
}
}
impl default::Default for PublicKey {
fn default() -> Self {
let secret_key = SecretKey::random();