2023-08-08 08:47:05 +00:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
|
|
|
//! Rust Bitcoin units library
|
|
|
|
//!
|
|
|
|
//! This library provides basic types used by the Rust Bitcoin ecosystem.
|
|
|
|
|
|
|
|
// Experimental features we need.
|
|
|
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
2024-01-25 06:41:01 +00:00
|
|
|
// Coding conventions.
|
2023-08-08 08:47:05 +00:00
|
|
|
#![warn(missing_docs)]
|
2024-01-25 06:41:01 +00:00
|
|
|
// Exclude lints we don't think are valuable.
|
2023-08-08 08:47:05 +00:00
|
|
|
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
2024-01-25 06:41:01 +00:00
|
|
|
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
2024-01-27 12:07:36 +00:00
|
|
|
#![no_std]
|
|
|
|
|
2023-08-08 08:47:05 +00:00
|
|
|
// Disable 16-bit support at least for now as we can't guarantee it yet.
|
|
|
|
#[cfg(target_pointer_width = "16")]
|
|
|
|
compile_error!(
|
|
|
|
"rust-bitcoin currently only supports architectures with pointers wider than 16 bits, let us
|
|
|
|
know if you want 16-bit support. Note that we do NOT guarantee that we will implement it!"
|
|
|
|
);
|
|
|
|
|
2024-01-27 12:07:36 +00:00
|
|
|
#[cfg(feature = "alloc")]
|
2023-08-08 08:47:05 +00:00
|
|
|
extern crate alloc;
|
|
|
|
|
2024-01-27 12:07:36 +00:00
|
|
|
#[cfg(feature = "std")]
|
|
|
|
extern crate std;
|
2023-08-08 08:47:05 +00:00
|
|
|
|
|
|
|
/// A generic serialization/deserialization framework.
|
|
|
|
#[cfg(feature = "serde")]
|
|
|
|
pub extern crate serde;
|
|
|
|
|
2024-03-13 01:59:53 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_use]
|
|
|
|
mod test_macros;
|
|
|
|
|
2023-08-08 08:47:05 +00:00
|
|
|
pub mod amount;
|
2024-03-11 05:00:19 +00:00
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
pub mod fee_rate;
|
|
|
|
#[cfg(feature = "alloc")]
|
2024-03-31 01:03:18 +00:00
|
|
|
pub mod locktime;
|
|
|
|
#[cfg(feature = "alloc")]
|
2024-03-11 05:00:19 +00:00
|
|
|
pub mod parse;
|
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
pub mod weight;
|
2023-08-08 08:47:05 +00:00
|
|
|
|
|
|
|
#[doc(inline)]
|
2024-03-31 01:03:18 +00:00
|
|
|
pub use self::amount::{Amount, ParseAmountError, SignedAmount};
|
2024-03-11 05:00:19 +00:00
|
|
|
#[cfg(feature = "alloc")]
|
|
|
|
pub use self::parse::ParseIntError;
|
|
|
|
|
|
|
|
#[rustfmt::skip]
|
|
|
|
#[allow(unused_imports)]
|
|
|
|
mod prelude {
|
|
|
|
#[cfg(all(feature = "alloc", not(feature = "std")))]
|
|
|
|
pub use alloc::{string::{String, ToString}, vec::Vec, boxed::Box, borrow::{Borrow, BorrowMut, Cow, ToOwned}, slice, rc};
|
|
|
|
|
|
|
|
#[cfg(feature = "std")]
|
|
|
|
pub use std::{string::{String, ToString}, vec::Vec, boxed::Box, borrow::{Borrow, BorrowMut, Cow, ToOwned}, rc};
|
|
|
|
}
|