Skip to content

Commit

Permalink
change Debug impl for Signature to use Display
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Nov 3, 2018
1 parent 30aa3a0 commit 68c838f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@ use std::marker::PhantomData;
pub struct RecoveryId(i32);

/// An ECDSA signature
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Signature(ffi::Signature);

impl fmt::Debug for Signature {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}

impl fmt::Display for Signature {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut v = [0; 72];
Expand Down Expand Up @@ -893,6 +899,7 @@ mod tests {

let sig = Signature::from_str(&hex_str).expect("byte str decode");
assert_eq!(&sig.to_string(), hex_str);
assert_eq!(&format!("{:?}", sig), hex_str);

assert!(Signature::from_str(
"3046022100839c1fbc5304de944f697c9f4b1d01d1faeba32d751c0f7acb21ac8a0f436a\
Expand Down

0 comments on commit 68c838f

Please sign in to comment.