bitcoin_units/
lib.rs

1// SPDX-License-Identifier: CC0-1.0
2
3//! Rust Bitcoin units library
4//!
5//! This library provides basic types used by the Rust Bitcoin ecosystem.
6
7// Experimental features we need.
8#![cfg_attr(docsrs, feature(doc_auto_cfg))]
9// Coding conventions.
10#![warn(missing_docs)]
11#![doc(test(attr(warn(unused))))]
12// Exclude lints we don't think are valuable.
13#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
14#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
15#![allow(clippy::needless_borrows_for_generic_args)] // https://github.com/rust-lang/rust-clippy/issues/12454
16#![no_std]
17
18#[cfg(feature = "alloc")]
19extern crate alloc;
20
21#[cfg(feature = "std")]
22extern crate std;
23
24pub mod amount;
25#[cfg(feature = "alloc")]
26pub mod block;
27#[cfg(feature = "alloc")]
28pub mod fee_rate;
29#[cfg(feature = "alloc")]
30pub mod locktime;
31#[cfg(feature = "alloc")]
32pub mod parse;
33#[cfg(feature = "alloc")]
34pub mod weight;
35
36#[doc(inline)]
37pub use self::amount::{Amount, SignedAmount};
38#[cfg(feature = "alloc")]
39#[doc(inline)]
40#[rustfmt::skip]
41pub use self::{
42    block::{BlockHeight, BlockInterval},
43    fee_rate::FeeRate,
44    weight::Weight
45};