Merge rust-bitcoin/rust-bitcoin#3561: bitcoin: Re-format crate level re-exports

6555143478 bitcoin: Re-format crate level re-exports (Tobin C. Harding)

Pull request description:

  Is there any advantage trying to lay out the re-exports to give users an idea of the crate structure?

  We have the explicit aim that users who depend on `bitcoin` do not ever need to reach directly into `primitives` (or `units`) however it is kind of nice to know where things come from, saves jumping to multiple files looking for them (for those of us that jump to files manually).

  I do not know how all the re-exports interact with other folks IDEs, I personally open files manually and just remember where stuff is.

ACKs for top commit:
  jamillambert:
    ACK 6555143478
  apoelstra:
    ACK 6555143478dbd2306d0506a29b7d83433e7b33f5; successfully ran local tests; If Jamil and Tobin are happy then I am happy

Tree-SHA512: 15fc9bec6ba34114b59f9eeb8b5377f8bc2957f10b37e8b41772b26f3240fa2b41bb67dc33575f54e1a42d4c3cc44f148630e328674bc1c9e0e3a29c9e6efa06
This commit is contained in:
merge-script 2024-11-04 17:30:18 +00:00
commit ce469a9e48
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 33 additions and 18 deletions

View File

@ -118,34 +118,49 @@ pub mod taproot;
#[doc(inline)]
pub use crate::{
address::{Address, AddressType, KnownHrp},
amount::{Amount, Denomination, SignedAmount},
bip158::{FilterHash, FilterHeader},
bip32::XKeyIdentifier,
blockdata::block::{self, Block, BlockHash, Header as BlockHeader, WitnessCommitment},
blockdata::constants,
blockdata::fee_rate::FeeRate,
blockdata::locktime::{self, absolute, relative},
blockdata::opcodes::{self, Opcode},
blockdata::script::witness_program::{self, WitnessProgram},
blockdata::script::witness_version::{self, WitnessVersion},
blockdata::script::{self, Script, ScriptBuf, ScriptHash, WScriptHash},
blockdata::transaction::{self, OutPoint, Transaction, TxIn, TxOut, Txid, Wtxid},
blockdata::weight::Weight,
blockdata::witness::{self, Witness},
crypto::ecdsa,
crypto::key::{self, PrivateKey, PubkeyHash, PublicKey, CompressedPublicKey, WPubkeyHash, XOnlyPublicKey},
crypto::sighash::{self, LegacySighash, SegwitV0Sighash, TapSighash, TapSighashTag},
merkle_tree::{MerkleBlock, TxMerkleNode, WitnessMerkleNode},
merkle_tree::MerkleBlock,
network::{Network, NetworkKind, TestnetVersion},
network::params::{self, Params},
pow::{CompactTarget, Target, Work},
pow::{Target, Work},
psbt::Psbt,
sighash::{EcdsaSighashType, TapSighashType},
taproot::{TapBranchTag, TapLeafHash, TapLeafTag, TapNodeHash, TapTweakHash, TapTweakTag},
};
// Re-export all modules from `blockdata`, users should never need to use `blockdata` directly.
#[doc(inline)]
pub use primitives::Sequence;
pub use units::{BlockHeight, BlockInterval};
pub use crate::{
// These modules also re-export all the respective `primitives` types.
blockdata::{block, constants, fee_rate, locktime, opcodes, script, transaction, weight, witness},
// And re-export types and modules from `blockdata` that don't come from `primitives`.
blockdata::block::Block, // TODO: Move this down below after it is in primitives.
blockdata::locktime::{absolute, relative},
blockdata::script::witness_program::{self, WitnessProgram},
blockdata::script::witness_version::{self, WitnessVersion},
blockdata::script::{ScriptHash, WScriptHash}, // TODO: Move these down below after they are in primitives.
};
#[doc(inline)]
pub use primitives::{
block::{BlockHash, WitnessCommitment, Header as BlockHeader},
merkle_tree::{TxMerkleNode, WitnessMerkleNode},
opcodes::Opcode,
pow::CompactTarget,
script::{Script, ScriptBuf},
transaction::{OutPoint, Transaction, TxIn, TxOut, Txid, Wtxid},
witness::Witness,
sequence::Sequence,
};
#[doc(inline)]
pub use units::{
amount::{Amount, Denomination, SignedAmount},
block::{BlockHeight, BlockInterval},
fee_rate::FeeRate,
weight::Weight
};
#[rustfmt::skip]
#[allow(unused_imports)]

View File

@ -49,8 +49,8 @@ pub use units::amount::{Amount, SignedAmount};
#[doc(inline)]
pub use units::{
block::{BlockHeight, BlockInterval},
fee_rate::FeeRate,
weight::Weight,
fee_rate::{self, FeeRate},
weight::{self, Weight},
};
#[doc(inline)]