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
47
48
use Decimal;
use ;
/// The `Price` struct represents a monetary value using a `Decimal` type for precision.
///
/// This struct derives several traits to enhance its usability:
/// - `Debug`: Allows for the `Price` struct to be formatted using the `{:?}` formatter,
/// useful for debugging purposes.
/// - `Clone`: Enables creating an exact duplicate of a `Price` instance.
/// - `Copy`: Enables creating duplicates of the `Price` instance without requiring an explicit call to `clone`.
/// - `PartialEq` and `Eq`: Allow for equality comparisons between two `Price` instances.
/// - `PartialOrd` and `Ord`: Allow for ordering comparisons between `Price` instances,
/// enabling sorting, minimum, and maximum operations.
/// - `Serialize` and `Deserialize`: Provide support for serializing and deserializing
/// `Price` instances, useful for formats like JSON.
///
/// # Fields
///
/// * `value` (`Decimal`): The numeric representation of the price. The `Decimal` type
/// is used to ensure precision, making the `Price` struct suitable for use cases
/// involving monetary calculations without the common pitfalls of floating-point inaccuracies.
///