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
//! # atomr-money
//!
//! Exact-decimal monetary primitives for the atomr substrate.
//!
//! Financial consumers (NAV/GL, OMS fills, fees, PnL/Greeks) need exact money
//! arithmetic — `f64` money is a regulatory and P&L-correctness defect. This
//! crate provides a [`Money`] type over [`rust_decimal::Decimal`] (128-bit)
//! behind a domain-safe API:
//!
//! * **No defaulted `f64` constructor.** Lossy `f64` ingestion exists only
//! behind the off-by-default `f64-lossy` feature.
//! * **String (de)serialization, never float.** [`Money`]/[`Price`]/[`Qty`]
//! serialize their amount as a decimal string so nothing is lost in transit
//! or at rest.
//! * **Checked arithmetic.** Currency mismatch and overflow return
//! [`MoneyError`] — never a panic or silent truncation.
//!
//! ```
//! use atomr_money::{Money, Currency};
//!
//! let a = Money::from_str_amount("10.25", Currency::USD).unwrap();
//! let b = Money::from_minor(75, Currency::USD); // 0.75
//! assert_eq!(a.checked_add(&b).unwrap().to_minor(), 1100);
//! ```
pub use Currency;
pub use MoneyError;
pub use ;
pub use ;
/// Re-export of the backing decimal type so consumers can construct exact
/// amounts without taking a direct `rust_decimal` dependency.
pub use Decimal;