1#![doc = include_str!(concat!(env!("OUT_DIR"), "/README-lib.md"))]
2#![forbid(unsafe_code)]
3#![deny(clippy::print_stdout, clippy::print_stderr)]
4#![cfg_attr(not(feature = "std"), no_std)]
5#![cfg_attr(docsrs, feature(doc_auto_cfg))]
6extern crate alloc;
7
8mod constants;
9mod decimal;
10mod error;
11mod ops;
12pub mod str;
13
14mod arithmetic_impls;
16
17#[cfg(feature = "rust-fuzz")]
18mod fuzz;
19#[cfg(feature = "maths")]
20mod maths;
21#[cfg(feature = "db-diesel-mysql")]
22mod mysql;
23#[cfg(any(
24 feature = "db-tokio-postgres",
25 feature = "db-postgres",
26 feature = "db-diesel-postgres",
27))]
28mod postgres;
29#[cfg(feature = "proptest")]
30mod proptest;
31#[cfg(feature = "rand")]
32mod rand;
33#[cfg(feature = "rand-0_9")]
34mod rand_0_9;
35#[cfg(feature = "rocket-traits")]
36mod rocket;
37#[cfg(all(
38 feature = "serde",
39 not(any(
40 feature = "serde-with-str",
41 feature = "serde-with-float",
42 feature = "serde-with-arbitrary-precision"
43 ))
44))]
45mod serde;
46#[cfg(all(
48 feature = "serde",
49 any(
50 feature = "serde-with-str",
51 feature = "serde-with-float",
52 feature = "serde-with-arbitrary-precision"
53 )
54))]
55pub mod serde;
56
57pub use decimal::{Decimal, RoundingStrategy};
58pub use error::Error;
59#[cfg(feature = "maths")]
60pub use maths::MathematicalOps;
61
62pub mod prelude {
64 #[cfg(feature = "macros")]
65 pub use super::dec;
66 #[cfg(feature = "maths")]
67 pub use crate::maths::MathematicalOps;
68 pub use crate::{Decimal, RoundingStrategy};
69 pub use core::str::FromStr;
70 pub use num_traits::{FromPrimitive, One, Signed, ToPrimitive, Zero};
71}
72
73#[cfg(feature = "macros")]
74pub use rust_decimal_macros::dec;
75
76#[cfg(feature = "diesel")]
77extern crate diesel;
78
79pub type Result<T> = core::result::Result<T, Error>;
82
83