Export the DisplayHex trait from within prelude

We use `internals::hex::display::DisplayHex` in many places, we can
improve ergonomics of the `internals` crate by re-exporting it from the
`prelude` module.
This commit is contained in:
Tobin C. Harding 2023-01-10 09:54:32 +11:00
parent 1f7affbc95
commit 70fe07f1ce
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
10 changed files with 2 additions and 9 deletions

View File

@ -53,7 +53,6 @@ use crate::prelude::*;
use alloc::rc::Rc; use alloc::rc::Rc;
use alloc::sync::Arc; use alloc::sync::Arc;
use bitcoin_internals::debug_from_display; use bitcoin_internals::debug_from_display;
use bitcoin_internals::hex::display::DisplayHex;
use crate::io; use crate::io;
use core::cmp::Ordering; use core::cmp::Ordering;
use core::convert::TryFrom; use core::convert::TryFrom;

View File

@ -489,7 +489,6 @@ impl From<Vec<&[u8]>> for Witness {
mod test { mod test {
use super::*; use super::*;
use bitcoin_internals::hex::display::DisplayHex;
use crate::consensus::{deserialize, serialize}; use crate::consensus::{deserialize, serialize};
use crate::internal_macros::hex; use crate::internal_macros::hex;
use crate::Transaction; use crate::Transaction;

View File

@ -21,7 +21,6 @@ use crate::prelude::*;
use core::{fmt, mem, u32, convert::From}; use core::{fmt, mem, u32, convert::From};
use bitcoin_internals::write_err; use bitcoin_internals::write_err;
use bitcoin_internals::hex::display::DisplayHex;
use crate::hashes::{sha256d, Hash, sha256}; use crate::hashes::{sha256d, Hash, sha256};
use crate::hash_types::{BlockHash, FilterHash, TxMerkleNode, FilterHeader}; use crate::hash_types::{BlockHash, FilterHash, TxMerkleNode, FilterHeader};

View File

@ -9,7 +9,6 @@ use core::str::FromStr;
use core::{fmt, iter}; use core::{fmt, iter};
use bitcoin_internals::write_err; use bitcoin_internals::write_err;
use bitcoin_internals::hex::display::DisplayHex;
use secp256k1; use secp256k1;
use crate::prelude::*; use crate::prelude::*;

View File

@ -187,6 +187,8 @@ mod prelude {
#[cfg(not(feature = "hashbrown"))] #[cfg(not(feature = "hashbrown"))]
pub use std::collections::HashSet; pub use std::collections::HashSet;
pub use bitcoin_internals::hex::display::DisplayHex;
} }
#[cfg(bench)] #[cfg(bench)]

View File

@ -499,7 +499,6 @@ impl Decodable for MerkleBlock {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use bitcoin_internals::hex::display::DisplayHex;
#[cfg(feature = "rand-std")] #[cfg(feature = "rand-std")]
use secp256k1::rand::prelude::*; use secp256k1::rand::prelude::*;

View File

@ -6,7 +6,6 @@
//! <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>. //! <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>.
//! //!
use bitcoin_internals::hex::display::DisplayHex;
use crate::prelude::*; use crate::prelude::*;
use core::fmt; use core::fmt;
use core::convert::TryFrom; use core::convert::TryFrom;

View File

@ -44,7 +44,6 @@ pub(crate) trait Deserialize: Sized {
impl PartiallySignedTransaction { impl PartiallySignedTransaction {
/// Serialize a value as bytes in hex. /// Serialize a value as bytes in hex.
pub fn serialize_hex(&self) -> String { pub fn serialize_hex(&self) -> String {
use bitcoin_internals::hex::display::DisplayHex;
self.serialize().to_lower_hex_string() self.serialize().to_lower_hex_string()
} }

View File

@ -1387,7 +1387,6 @@ mod tests {
}) })
} }
use bitcoin_internals::hex::display::DisplayHex;
use secp256k1::{self, SecretKey, XOnlyPublicKey}; use secp256k1::{self, SecretKey, XOnlyPublicKey};
use crate::consensus::serde as con_serde; use crate::consensus::serde as con_serde;

View File

@ -1094,7 +1094,6 @@ impl std::error::Error for TaprootError {
mod test { mod test {
use core::str::FromStr; use core::str::FromStr;
use bitcoin_internals::hex::display::DisplayHex;
use secp256k1::{VerifyOnly, XOnlyPublicKey}; use secp256k1::{VerifyOnly, XOnlyPublicKey};
use super::*; use super::*;