monacoin/
lib.rs

1// Rust Bitcoin Library
2// Written in 2014 by
3//   Andrew Poelstra <apoelstra@wpsoftware.net>
4//
5// To the extent possible under law, the author(s) have dedicated all
6// copyright and related and neighboring rights to this software to
7// the public domain worldwide. This software is distributed without
8// any warranty.
9//
10// You should have received a copy of the CC0 Public Domain Dedication
11// along with this software.
12// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13//
14
15//! # Rust Bitcoin Library
16//!
17//! This is a library for which supports the Bitcoin network protocol and associated
18//! primitives. It is designed for Rust programs built to work with the Bitcoin
19//! network.
20//!
21//! It is also written entirely in Rust to illustrate the benefits of strong type
22//! safety, including ownership and lifetime, for financial and/or cryptographic
23//! software.
24//!
25
26#![crate_name = "monacoin"]
27#![crate_type = "dylib"]
28#![crate_type = "rlib"]
29
30// Experimental features we need
31#![cfg_attr(all(test, feature = "unstable"), feature(test))]
32
33// Clippy whitelist
34#![cfg_attr(feature = "clippy", allow(needless_range_loop))] // suggests making a big mess of array newtypes
35#![cfg_attr(feature = "clippy", allow(extend_from_slice))]   // `extend_from_slice` only available since 1.6
36
37// Coding conventions
38#![forbid(unsafe_code)]
39#![deny(non_upper_case_globals)]
40#![deny(non_camel_case_types)]
41#![deny(non_snake_case)]
42#![deny(unused_mut)]
43#![deny(dead_code)]
44#![deny(unused_imports)]
45#![deny(missing_docs)]
46#![forbid(unsafe_code)]
47
48// In general, rust is absolutely horrid at supporting users doing things like,
49// for example, compiling Rust code for real environments. Disable useless lints
50// that don't do anything but annoy us and cant actually ever be resolved.
51#![allow(bare_trait_objects)]
52#![allow(ellipsis_inclusive_range_patterns)]
53
54// Re-exported dependencies.
55#[macro_use] pub extern crate bitcoin_hashes as hashes;
56pub extern crate secp256k1;
57pub extern crate bech32;
58
59#[cfg(feature = "serde")] extern crate serde;
60#[cfg(all(test, feature = "serde"))] #[macro_use] extern crate serde_derive; // for 1.22.0 compat
61#[cfg(all(test, feature = "serde"))] extern crate serde_json;
62#[cfg(all(test, feature = "serde"))] extern crate serde_test;
63#[cfg(all(test, feature = "unstable"))] extern crate test;
64#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus;
65
66#[cfg(target_pointer_width = "16")]
67compile_error!("rust-bitcoin cannot be used on 16-bit architectures");
68
69#[cfg(test)]
70#[macro_use]
71mod test_macros;
72#[macro_use]
73mod internal_macros;
74#[macro_use]
75pub mod network;
76pub mod blockdata;
77pub mod util;
78pub mod consensus;
79// Do not remove: required in order to get hash types implementation macros to work correctly
80#[allow(unused_imports)]
81pub mod hash_types;
82
83pub use hash_types::*;
84pub use blockdata::block::Block;
85pub use blockdata::block::BlockHeader;
86pub use blockdata::script::Script;
87pub use blockdata::transaction::Transaction;
88pub use blockdata::transaction::TxIn;
89pub use blockdata::transaction::TxOut;
90pub use blockdata::transaction::OutPoint;
91pub use blockdata::transaction::SigHashType;
92pub use consensus::encode::VarInt;
93pub use network::constants::Network;
94pub use util::Error;
95pub use util::address::Address;
96pub use util::address::AddressType;
97pub use util::amount::Amount;
98pub use util::amount::SignedAmount;
99pub use util::key::PrivateKey;
100pub use util::key::PublicKey;
101pub use util::merkleblock::MerkleBlock;