Remove the impl_array_newtype_show macro
Instead, implement Debug in impl_bytes_newtype.
This commit is contained in:
parent
0ab8823984
commit
d527a2c2cf
|
@ -95,17 +95,6 @@ macro_rules! impl_array_newtype {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implements debug formatting for a given wrapper type
|
|
||||||
macro_rules! impl_array_newtype_show {
|
|
||||||
($thing:ident) => {
|
|
||||||
impl ::std::fmt::Debug for $thing {
|
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
|
||||||
write!(f, concat!(stringify!($thing), "({:?})"), &self[..])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Implements standard indexing methods for a given wrapper type
|
/// Implements standard indexing methods for a given wrapper type
|
||||||
macro_rules! impl_index_newtype {
|
macro_rules! impl_index_newtype {
|
||||||
($thing:ident, $ty:ty) => {
|
($thing:ident, $ty:ty) => {
|
||||||
|
@ -583,6 +572,12 @@ macro_rules! impl_bytes_newtype {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ::std::fmt::Debug for $t {
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
|
fmt::LowerHex::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl $crate::hashes::hex::FromHex for $t {
|
impl $crate::hashes::hex::FromHex for $t {
|
||||||
fn from_byte_iter<I>(iter: I) -> Result<Self, $crate::hashes::hex::Error>
|
fn from_byte_iter<I>(iter: I) -> Result<Self, $crate::hashes::hex::Error>
|
||||||
where I: ::std::iter::Iterator<Item=Result<u8, $crate::hashes::hex::Error>> +
|
where I: ::std::iter::Iterator<Item=Result<u8, $crate::hashes::hex::Error>> +
|
||||||
|
|
|
@ -33,14 +33,12 @@ use util::key::{self, PublicKey, PrivateKey};
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct ChainCode([u8; 32]);
|
pub struct ChainCode([u8; 32]);
|
||||||
impl_array_newtype!(ChainCode, u8, 32);
|
impl_array_newtype!(ChainCode, u8, 32);
|
||||||
impl_array_newtype_show!(ChainCode);
|
|
||||||
impl_bytes_newtype!(ChainCode, 32);
|
impl_bytes_newtype!(ChainCode, 32);
|
||||||
|
|
||||||
/// A fingerprint
|
/// A fingerprint
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct Fingerprint([u8; 4]);
|
pub struct Fingerprint([u8; 4]);
|
||||||
impl_array_newtype!(Fingerprint, u8, 4);
|
impl_array_newtype!(Fingerprint, u8, 4);
|
||||||
impl_array_newtype_show!(Fingerprint);
|
|
||||||
impl_bytes_newtype!(Fingerprint, 4);
|
impl_bytes_newtype!(Fingerprint, 4);
|
||||||
|
|
||||||
impl Default for Fingerprint {
|
impl Default for Fingerprint {
|
||||||
|
|
Loading…
Reference in New Issue