pub trait NumericValue: Sized {
// Required methods
fn try_to_decimal(&self) -> Option<Decimal>;
fn try_from_decimal(value: Decimal) -> Option<Self>;
}Expand description
NumericValue
Fallible numeric round-trip contract used by generic validators and sanitizers.
Implementors convert through Decimal so numeric policy stays explicit and local.
Required Methods§
Sourcefn try_to_decimal(&self) -> Option<Decimal>
fn try_to_decimal(&self) -> Option<Decimal>
Convert this value into Decimal for generic numeric handling.
Sourcefn try_from_decimal(value: Decimal) -> Option<Self>
fn try_from_decimal(value: Decimal) -> Option<Self>
Rebuild the value from Decimal after generic numeric handling.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.