Skip to main content

NumericValue

Trait NumericValue 

Source
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§

Source

fn try_to_decimal(&self) -> Option<Decimal>

Convert this value into Decimal for generic numeric handling.

Source

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.

Implementations on Foreign Types§

Source§

impl NumericValue for f32

Source§

impl NumericValue for f64

Source§

impl NumericValue for i8

Source§

impl NumericValue for i16

Source§

impl NumericValue for i32

Source§

impl NumericValue for i64

Source§

impl NumericValue for i128

Source§

impl NumericValue for isize

Source§

impl NumericValue for u8

Source§

impl NumericValue for u16

Source§

impl NumericValue for u32

Source§

impl NumericValue for u64

Source§

impl NumericValue for u128

Source§

impl NumericValue for usize

Implementors§