Skip to main content

Module numeric

Module numeric 

Source
Expand description

Numeric rules: sign checks and inclusive integer ranges.

Sign rules (Positive, NonNegative, Negative, NonPositive) apply to the signed integer and floating-point primitives. InRange applies to the integer primitives that fit losslessly in an i64 (i8/i16/i32/i64, u8/u16/u32).

Structsยง

InRange
Accepts integers within the inclusive range MIN..=MAX.
Negative
Accepts strictly negative numbers (value < 0).
NonNegative
Accepts non-negative numbers (value >= 0).
NonPositive
Accepts non-positive numbers (value <= 0).
Positive
Accepts strictly positive numbers (value > 0).