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
// Bitcoin Numeric Library
// Written in 2020 by
//   Dr. Maxim Orlovsky <orlovsky@pandoracore.com>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication
// along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//

//! # Rust Bibtcoin Numeric Library
//!
//! This is a simple, no-dependency library which implements utility functions
//! for working with big integers, hex encodings etc needed by Bitcoin. It
//! differs from other existing cragtes in the field in it's focus on
//! supporting the same versions of Rust compilers as `bitcoin` and
//! `bitcoin_hashes` crates and not using any external dependencies in order
//! to reduce potential attack surface.
//!

// Coding conventions
#![deny(non_upper_case_globals)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![deny(missing_docs)]
// In general, rust is absolutely horrid at supporting users doing things like,
// for example, compiling Rust code for real environments. Disable useless lints
// that don't do anything but annoy us and cant actually ever be resolved.
#![allow(bare_trait_objects)]
#![allow(ellipsis_inclusive_range_patterns)]
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
#[cfg(all(test, feature = "unstable"))]
extern crate test;

#[cfg(any(test, feature = "std"))]
pub extern crate core;
#[cfg(feature = "serde")]
extern crate serde;

#[cfg(any(test, feature = "std"))]
mod std_impls;

pub mod endian;
pub mod hex;
#[macro_use]
mod macros;
#[cfg(feature = "serde")]
pub mod serialize;
pub mod uint;
pub mod util;