bitcoin_primitives/
lib.rs1#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
13#![cfg_attr(docsrs, feature(doc_auto_cfg))]
15#![warn(missing_docs)]
17#![warn(deprecated_in_future)]
18#![doc(test(attr(warn(unused))))]
19#![allow(clippy::needless_question_mark)] #![allow(clippy::manual_range_contains)] #[cfg(feature = "alloc")]
24extern crate alloc;
25
26#[cfg(feature = "std")]
27extern crate std;
28
29#[cfg(feature = "serde")]
30#[macro_use]
31extern crate serde;
32
33pub mod block;
34#[cfg(feature = "alloc")]
35pub mod locktime;
36pub mod merkle_tree;
37pub mod opcodes;
38pub mod pow;
39#[cfg(feature = "alloc")]
40pub mod script;
41pub mod sequence;
42pub mod taproot;
43pub mod transaction;
44#[cfg(feature = "alloc")]
45pub mod witness;
46
47#[doc(inline)]
48pub use units::amount::{self, Amount, SignedAmount};
49#[doc(inline)]
50#[cfg(feature = "alloc")]
51pub use units::{
52 block::{BlockHeight, BlockInterval},
53 fee_rate::{self, FeeRate},
54 weight::{self, Weight},
55};
56#[doc(inline)]
57#[cfg(feature = "alloc")]
58pub use self::{
59 block::{
60 Block, Checked as BlockChecked, Unchecked as BlockUnchecked, Validation as BlockValidation,
61 },
62 locktime::{absolute, relative},
63 transaction::{Transaction, TxIn, TxOut},
64 witness::Witness,
65};
66#[doc(inline)]
67pub use self::{
68 block::{BlockHash, Header as BlockHeader, WitnessCommitment},
69 merkle_tree::{TxMerkleNode, WitnessMerkleNode},
70 pow::CompactTarget,
71 sequence::Sequence,
72 taproot::{TapBranchTag, TapLeafHash, TapLeafTag, TapNodeHash, TapTweakHash, TapTweakTag},
73 transaction::{Txid, Wtxid},
74};
75
76#[rustfmt::skip]
77#[allow(unused_imports)]
78mod prelude {
79 #[cfg(feature = "alloc")]
80 pub use alloc::collections::{BTreeMap, BTreeSet, btree_map, BinaryHeap};
81
82 #[cfg(feature = "alloc")]
83 pub use alloc::{string::{String, ToString}, vec::Vec, boxed::Box, borrow::{Borrow, BorrowMut, Cow, ToOwned}, slice, rc};
84
85 #[cfg(all(feature = "alloc", target_has_atomic = "ptr"))]
86 pub use alloc::sync;
87}