Move debug_from_display to bitcoin_internals
This is an internal macro, now that we have the `internals` crate put `debug_from_display` in it.
This commit is contained in:
parent
a2f08f2bc6
commit
5a8a5ff6c9
|
@ -14,7 +14,7 @@
|
|||
#[cfg(feature = "serde")] use crate::prelude::*;
|
||||
|
||||
use core::{fmt, convert::From};
|
||||
use crate::internal_macros::debug_from_display;
|
||||
use bitcoin_internals::debug_from_display;
|
||||
|
||||
// Note: I am deliberately not implementing PartialOrd or Ord on the
|
||||
// opcode enum. If you want to check ranges of opcodes, etc.,
|
||||
|
|
|
@ -18,7 +18,7 @@ use crate::io;
|
|||
use core::convert::TryFrom;
|
||||
use core::{fmt, default::Default};
|
||||
use core::ops::Index;
|
||||
use crate::internal_macros::debug_from_display;
|
||||
use bitcoin_internals::debug_from_display;
|
||||
#[cfg(feature = "bitcoinconsensus")]
|
||||
use bitcoin_internals::write_err;
|
||||
|
||||
|
|
|
@ -45,17 +45,6 @@ macro_rules! impl_consensus_encoding {
|
|||
);
|
||||
}
|
||||
pub(crate) use impl_consensus_encoding;
|
||||
|
||||
macro_rules! debug_from_display {
|
||||
($thing:ident) => {
|
||||
impl core::fmt::Debug for $thing {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
|
||||
core::fmt::Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pub(crate) use debug_from_display;
|
||||
// We use test_macros module to keep things organised, re-export everything for ease of use.
|
||||
#[cfg(test)]
|
||||
pub(crate) use test_macros::*;
|
||||
|
|
|
@ -32,13 +32,13 @@ use core::str::FromStr;
|
|||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use bitcoin_internals::{debug_from_display, write_err};
|
||||
|
||||
use crate::io;
|
||||
use crate::prelude::{String, ToOwned};
|
||||
use crate::consensus::encode::{self, Encodable, Decodable};
|
||||
use crate::internal_macros::debug_from_display;
|
||||
use crate::hashes::hex::{FromHex, Error};
|
||||
use crate::error::impl_std_error;
|
||||
use bitcoin_internals::write_err;
|
||||
|
||||
/// Version of the protocol as appearing in network message headers
|
||||
/// This constant is used to signal to other peers which features you support.
|
||||
|
|
|
@ -61,3 +61,15 @@ macro_rules! impl_array_newtype {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Implements `Debug` by calling through to `Display`.
|
||||
#[macro_export]
|
||||
macro_rules! debug_from_display {
|
||||
($thing:ident) => {
|
||||
impl core::fmt::Debug for $thing {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
|
||||
core::fmt::Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue