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
extern crate decimal;

#[cfg(feature = "serde")]
extern crate serde;

#[cfg(feature = "serde")]
#[cfg(test)]
extern crate serde_json;






#[macro_use]
mod macros {
    /// A macro to construct Decimal literals.
    /// Note: that it will panic if invalid literals are provided as input.
    ///
    /// # Examples:
    /// ```
    /// # #[macro_use]
    /// # extern crate pure_decimal;
    ///
    /// # use std::collections::BTreeMap;
    ///
    /// # fn main() {
    /// assert!(decimal!(0).is_zero());
    /// assert!(decimal!(-0.1).is_negative());
    ///
    /// # }
    /// ```
    #[macro_export]
    macro_rules! decimal {
        ($lit:expr) => {{
            use std::str::FromStr;
            $crate::Decimal::from_str(stringify!($lit)).expect("Invalid decimal float literal")
        }}
    }
}

mod error;
mod pure_decimal;

pub use error::Error;
pub use pure_decimal::Decimal;