Skip to main content

DecimalValue

Trait DecimalValue 

pub trait DecimalValue:
    Clone
    + Debug
    + Display
    + FromStr
    + PartialEq
    + PartialOrd
    + From<i64>
    + Send
    + Sync
    + 'static { }
Expand description

Backend-agnostic bound for a decimal scalar. Blanket-implemented for any type satisfying these bounds — deliberately structural rather than naming rust_decimal::Decimal / bigdecimal::BigDecimal explicitly, so this trait (and everything written against it, e.g. validators::validate_range_decimal) compiles unconditionally, with no #[cfg] gate of its own and no dependency on either optional backend crate.

From<i64> is required so @range integer bounds (amount Decimal @range(min: 0)) can be promoted to the field’s own decimal type for comparison — both rust_decimal::Decimal and bigdecimal::BigDecimal implement it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<T> DecimalValue for T
where T: Clone + Debug + Display + FromStr + PartialEq + PartialOrd + From<i64> + Send + Sync + 'static,