Merge rust-bitcoin/rust-bitcoin#1537: Export the DisplayHex trait from within prelude

70fe07f1ce Export the DisplayHex trait from within prelude (Tobin C. Harding)

Pull request description:

  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.

ACKs for top commit:
  Kixunil:
    ACK 70fe07f1ce
  apoelstra:
    ACK 70fe07f1ce

Tree-SHA512: 96a89135cb0b829b7b5926a3b344f78e178b5b48e772a69da5133fab6d2e14e7b7bbaa56b7a417a5c1a64337546a1c7bac32307d3a1f27aa199ed61f590902bf
This commit is contained in:
Andrew Poelstra 2023-01-16 15:10:06 +00:00
commit 649bf023af
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
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

@ -1101,7 +1101,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::*;