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
use super::*;

#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct DecimalConstraint {
    pub kind: DecimalKind,
    /// Minimum length of utf8 string
    pub min: Option<BigDecimal>,
    /// Minimum number of unicode characters
    pub min_inclusive: bool,
    /// Maximum length of utf8 string
    pub max: Option<BigDecimal>,
    /// Maximum number of unicode characters
    pub max_inclusive: bool,
    #[serde(flatten)]
    pub info: SharedConstraint,
}

#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
pub enum DecimalKind {
    Decimal,
    Decimal8,
    Decimal16,
    Decimal32,
    Decimal64,
    Decimal128,
}

impl Default for DecimalKind {
    fn default() -> Self {
        Self::Decimal32
    }
}