amplify/
lib.rs

1// Rust language amplification library providing multiple generic trait
2// implementations, type wrappers, derive macros and other language enhancements
3//
4// Written in 2019-2022 by
5//     Dr. Maxim Orlovsky <orlovsky@ubideco.org>
6//     Martin Habovstiak <martin.habovstiak@gmail.com>
7//
8// To the extent possible under law, the author(s) have dedicated all
9// copyright and related and neighboring rights to this software to
10// the public domain worldwide. This software is distributed without
11// any warranty.
12//
13// You should have received a copy of the MIT License
14// along with this software.
15// If not, see <https://opensource.org/licenses/MIT>.
16
17//! Amplifying Rust language capabilities: multiple generic trait
18//! implementations, type wrappers, derive macros.
19//!
20//! Minimum supported rust compiler version (MSRV): 1.46 (stable channel)
21
22#![cfg_attr(not(feature = "std"), no_std)]
23
24#[cfg(feature = "alloc")]
25pub extern crate alloc;
26extern crate core;
27
28#[cfg(feature = "derive")]
29extern crate amplify_derive;
30#[cfg(feature = "derive")]
31pub use amplify_derive::{Wrapper, WrapperMut, Display, AsAny, From, Getters, Error};
32
33#[cfg(feature = "serde")]
34#[macro_use]
35extern crate serde_crate as serde;
36
37extern crate amplify_num;
38
39#[cfg(any(test, feature = "hex"))]
40pub use num::hex;
41
42#[cfg(feature = "stringly_conversions")]
43pub use stringly_conversions;
44#[cfg(feature = "stringly_conversions")]
45pub use stringly_conversions::*;
46
47#[cfg(feature = "proc_attr")]
48pub use amplify_syn as proc_attr;
49#[cfg(feature = "proc_attr")]
50pub use proc_attr::ident;
51
52pub use ascii;
53
54#[macro_use]
55mod macro_default;
56#[cfg(feature = "std")]
57#[macro_use]
58mod macro_std;
59#[cfg(feature = "alloc")]
60#[macro_use]
61mod macro_alloc;
62
63#[cfg(feature = "std")]
64mod io_util;
65pub mod strategy;
66
67mod collection;
68pub use collection::*;
69
70#[cfg(feature = "std")]
71mod error;
72mod traits;
73
74#[cfg(feature = "std")]
75pub use error::{IntoMultiError, MultiError};
76pub use traits::*;
77
78pub mod num {
79    //! Custom-sized numeric types
80    //!
81    //! Implementation of various integer types with custom bit dimension.
82    //! These include:
83    //! * large signed and unsigned integers, named *gib int types* (256, 512,
84    //!   1024-bit)
85    //! * custom sub-8 bit unsigned integers, named *small int types (5-, 6-,
86    //!   7-bit)
87    //! * 24-bit signed integer.
88    //!
89    //! The functions here are designed to be fast.
90
91    pub use amplify_num::*;
92    #[cfg(feature = "apfloat")]
93    pub use amplify_apfloat as apfloat;
94}
95
96#[cfg(feature = "std")]
97pub use crate::io_util::{IoError, WriteCounter, ConfinedIo};
98pub use crate::strategy::Holder;