dubp_common/
lib.rs

1//  Copyright (C) 2020  Éloïs SANCHEZ.
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU Affero General Public License as
5// published by the Free Software Foundation, either version 3 of the
6// License, or (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16//! Provide common tools for DUBP.
17
18#![deny(
19    clippy::expect_used,
20    clippy::unwrap_used,
21    missing_debug_implementations,
22    missing_copy_implementations,
23    trivial_casts,
24    trivial_numeric_casts,
25    unstable_features,
26    unused_import_braces
27)]
28
29pub mod bin_file;
30mod block_hash;
31mod block_number;
32mod blockstamp;
33pub mod bytes_traits;
34mod currency_name;
35pub mod currency_params;
36pub mod errors;
37mod unescape_str;
38
39// Re export crates
40pub use dup_crypto as crypto;
41
42// Prelude
43pub mod prelude {
44    pub use crate::block_hash::BlockHash;
45    pub use crate::block_number::BlockNumber;
46    pub use crate::blockstamp::{
47        Blockstamp, BlockstampFromBytesError, BlockstampParseError, PreviousBlockstamp,
48    };
49    pub use crate::currency_name::{CurrencyName, DEFAULT_CURRENCY};
50    pub use crate::errors::DocumentSigsErr;
51    pub use crate::unescape_str::unescape_str;
52    pub use thiserror::Error;
53}
54
55// Crate imports
56pub(crate) use crate::currency_params::ParseParamsError;
57pub(crate) use crate::prelude::*;
58pub(crate) use dup_crypto::{bases::BaseConversionError, hashs::Hash, keys::SigError};
59pub(crate) use serde::{Deserialize, Serialize};
60pub(crate) use std::{
61    cmp::Ordering,
62    collections::HashMap,
63    error::Error,
64    fmt::{Debug, Display, Error as FmtError, Formatter},
65    fs::File,
66    io::Read,
67    io::Write,
68    path::Path,
69    str::FromStr,
70};