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;
12mod str;
13
14mod arithmetic_impls;
16
17mod arithmetic_ext;
18
19#[cfg(feature = "rust-fuzz")]
20mod fuzz;
21#[cfg(feature = "maths")]
22mod maths;
23#[cfg(feature = "db-diesel-mysql")]
24mod mysql;
25#[cfg(any(
26 feature = "db-tokio-postgres",
27 feature = "db-postgres",
28 feature = "db-diesel-postgres",
29))]
30mod postgres;
31#[cfg(feature = "proptest")]
32mod proptest;
33#[cfg(feature = "rand")]
34mod rand;
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 {
67 #[cfg(feature = "maths")]
68 pub use crate::maths::MathematicalOps;
69 pub use crate::{Decimal, RoundingStrategy};
70 pub use core::str::FromStr;
71 pub use num_traits::{FromPrimitive, One, Signed, ToPrimitive, Zero};
72 }
75
76#[cfg(feature = "diesel")]
77extern crate diesel;
78
79pub type Result<T> = core::result::Result<T, Error>;
82
83