1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// SPDX-License-Identifier: CC0-1.0
//! Basic (numeric) types used by the Rust Bitcoin ecosystem.
//!
//! This crate contains basic types that have minimal requirements on the platform they run on.
//! Specifically, they do not require an allocator and they do not require `usize` to be at least
//! 32-bit. If you need more than this crate provides check the [`bitcoin`] crate or the
//! [`bitcoin-primitives`] crate.
//!
//! # Guidance on crate use
//!
//! *If you are using the `bitcoin` crate then you do not need to access this crate directly.*
//!
//! Everything here is re-exported in `bitcoin` at the same path. Also the same re-exports exist in
//! `bitcoin-primitives` if you are using that crate instead of `bitcoin`.
//!
//! Libraries that only need the types present in this crate should depend only on this crate, not
//! `bitcoin` or `bitcoin-primitives` so that they don't add bloat to compilation and review. It is
//! recommended that binaries or other root crates depend on `bitcoin` during the prototyping stage
//! and then optionally try to trim down the dependencies by using the leaf crates. However this is
//! unlikely to be feasible for non-trivial applications.
//!
//! ## Features
//!
//! * `std` - turns on `std` integration, mainly the `std::error::Error` trait in old Rust versions.
//! * `alloc` - turns on features that require the `alloc` crate, such as `String` interop.
//! * `serde` - causes the crate to depend on `serde` and provide support for serializing and
//! deserializing its types.
//! * `arbitrary` - causes the crate to depend on `arbitrary` and implement the `Arbitrary` trait.
//! * `encoding` - causes the crate to depend on `bitcoin-consensus-encoding` and provide consensus
//! encoders and decoders for its types.
//!
//! # MSRV
//!
//! This crate supports Rust 1.74, however some of its dependencies may not do so or may require
//! pinning. Similarly, some features may require newer Rust version (implicitly or explicitly).
//!
//! ## Policy
//!
//! Our MSRV policy is to only bump MSRV to the one that is available on the latest Debian stable
//! and is at least two years old. However, we will try to be even more conservative when practical
//! given this crate is very widely used.
//!
//! # Examples
//!
//! ```
//! // Exactly the same as `use bitcoin::{amount, Amount}`.
//! use bitcoin_units::{amount, Amount};
//!
//! let amount = Amount::from_sat(1_000)?;
//! # let _ = amount;
//! # Ok::<_, amount::OutOfRangeError>(())
//! ```
//!
//! [`bitcoin`]: https://docs.rs/bitcoin
//! [`bitcoin-primitives`]: https://docs.rs/bitcoin-primitives
// Coding conventions.
// Extra restriction lints.
// Avoid implicit panics from indexing/slicing.
extern crate alloc;
extern crate std;
pub extern crate arbitrary;
pub extern crate encoding;
pub extern crate serde;
pub use ;
// decoder_newtype! macro
include!;