Skip to main content

NumericValue

Trait NumericValue 

Source
pub trait NumericValue: Copy {
    // Required methods
    fn check_bounds(
        self,
        field: &str,
        min: Option<f64>,
        max: Option<f64>,
        gt: Option<f64>,
        lt: Option<f64>,
        multiple_of: Option<i64>,
    ) -> Result<(), FieldIssue>;
    fn check_positive(self, field: &str) -> Result<(), FieldIssue>;
    fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>;
    fn check_finite(self, field: &str) -> Result<(), FieldIssue>;
}
Expand description

Type-aware numeric validation across integers and floating-point numbers.

Required Methods§

Source

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source

fn check_finite(self, field: &str) -> Result<(), FieldIssue>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl NumericValue for f32

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for f64

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for i8

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for i16

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for i32

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for i64

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for i128

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for isize

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for u8

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, _field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for u16

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, _field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for u32

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, _field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for u64

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, _field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for u128

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, _field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Source§

impl NumericValue for usize

Source§

fn check_bounds( self, field: &str, min: Option<f64>, max: Option<f64>, gt: Option<f64>, lt: Option<f64>, multiple_of: Option<i64>, ) -> Result<(), FieldIssue>

Source§

fn check_positive(self, field: &str) -> Result<(), FieldIssue>

Source§

fn check_non_negative(self, _field: &str) -> Result<(), FieldIssue>

Source§

fn check_finite(self, _field: &str) -> Result<(), FieldIssue>

Implementors§