Function validate_range_decimal
pub fn validate_range_decimal<D>(
field: &'static str,
value: &D,
min: Option<i64>,
max: Option<i64>,
) -> Result<(), CratestackError>where
D: DecimalValue,Expand description
Decimal-typed @range enforcement. The parser accepts integer
bounds (@range(min: 0, max: 100)) on both Int and Decimal
fields; the i64 bounds are promoted to Decimal here so monetary
fields can declare the same shape as integer counters. Banks
routinely write things like amount Decimal @range(min: 0) to
forbid negative amounts at the framework layer — without this,
the validator silently no-ops and out-of-range values reach the
database.
Generic over DecimalValue (cratestack#505 Direction 2) rather than
the crate’s single Decimal alias, so this function is unconditional —
no #[cfg] gate, no dependency on either backend feature — and works
identically for RustDecimal, BigDecimal, or any other type
satisfying the bound. Generated code calls this with value already
typed as the field’s own concrete decimal type, so D is inferred at
the call site; no turbofish needed.