Merge rust-bitcoin/rust-secp256k1#398: Implement LowerHex and Display for Message
a209836a99
Implement LowerHex and Display for Message (Tobin Harding) Pull request description: Implement `fmt::LowerHex` for `Message`. Implement `Display` by calling `LowerHex`. Resolves: #251 ACKs for top commit: apoelstra: ACKa209836a99
Tree-SHA512: 64eeafc57ea2814108228d8427cd650076eb3cbb85ae14a7c5a6f39f5e20ca9b83b4ccc27c201668fd57a34fde0a37be4098aa5c602208a81a2018293b40b64d
This commit is contained in:
commit
f97e41ae21
15
src/lib.rs
15
src/lib.rs
|
@ -324,6 +324,21 @@ impl<T: ThirtyTwoByteHash> From<T> for Message {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::LowerHex for Message {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
for byte in self.0.iter() {
|
||||
write!(f, "{:02x}", byte)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Message {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::LowerHex::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
/// An ECDSA error
|
||||
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)]
|
||||
pub enum Error {
|
||||
|
|
Loading…
Reference in New Issue