icydb-model 0.219.0

IcyDB application-model authoring, validation, and code generation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
//! Module: base::helper
//!
//! Responsibility: shared base helper routines.
//! Does not own: domain validation policy or runtime persistence.
//! Boundary: supports base normalizers and validators with local conversions.

use crate::{prelude::*, schema::NumericValue};

/// Convert an arbitrary numeric value into `Decimal`.
pub(crate) fn try_cast_decimal<N: NumericValue>(value: &N) -> Option<Decimal> {
    value.try_to_decimal()
}