serde_decimal/lib.rs
1//! Careful serialization and deserialization of [`rust_decimal`] types.
2//!
3//! Several tests in these modules will fail if one were to naively apply e.g.,
4//! `#[serde(with = "rust_decimal::serde::float_option")]`.
5//! This module provides alternative modules to be used with `#[serde(with = ...)]`.
6//! This circumvents bugs in the [rust_decimal::serde] modules and adds modules for serialization
7//! and deserialization of `Option<Option<Decimal>>`.
8//!
9//! * use [double_option_float] for `Option<Option<Decimal>>` where the field may be missing and may
10//! be null.
11//! * use [non_required_float] for `Option<Decimal>` where the field may be missing but may not be
12//! null.
13//! * use [nullable_float] for `Option<Decimal>` where the field is required but may be null.
14//! * use [double_option_str] for `Option<Option<Decimal>>` where the field may be missing and may
15//! be null.
16//! * use [non_required_str] for `Option<Decimal>` where the field may be missing but may not be
17//! null.
18//! * use [nullable_str] for `Option<Decimal>` where the field is required but may be null.
19//! * use `double_option_arbitrary_precision` for `Option<Option<Decimal>>` where the field may be
20//! missing and may be null.
21//! * use `non_required_arbitrary_precision` for `Option<Decimal>` where the field may be missing
22//! but may not be null.
23//! * use `nullable_arbitrary_precision` for `Option<Decimal>` where the field is required but may
24//! be null.
25
26#![cfg_attr(docsrs, feature(doc_auto_cfg))]
27
28pub mod double_option_float;
29pub mod non_required_float;
30pub mod nullable_float;
31
32pub mod double_option_str;
33pub mod non_required_str;
34pub mod nullable_str;
35
36#[cfg(feature = "rust-decimal-arbitrary-precision")]
37pub mod double_option_arbitrary_precision;
38#[cfg(feature = "rust-decimal-arbitrary-precision")]
39pub mod non_required_arbitrary_precision;
40#[cfg(feature = "rust-decimal-arbitrary-precision")]
41pub mod nullable_arbitrary_precision;