pub trait Numeric:
Copy
+ PartialOrd
+ Display {
const KIND: &'static str;
// Required methods
fn read(raw: &str) -> Option<(Self, Value)>;
fn divisible_by(self, step: Self) -> bool;
}Expand description
The two number kinds a document can ask one flag for.
A trait rather than two copies of Bounds and its rules: the comparisons
are the same sentence in both, and only reading a value out of an argument
and dividing by one differ. It is public because Bounds is, and there is
no third kind to implement it for — i64 and f64 are what OpenAPI’s
integer and number are.
Required Associated Constants§
Required Methods§
Sourcefn read(raw: &str) -> Option<(Self, Value)>
fn read(raw: &str) -> Option<(Self, Value)>
This kind read out of one argument, with the JSON it goes out as.
One step, because the two can disagree: a float that parses but is not
finite is not a number JSON carries, and “is not a number” is the honest
answer rather than a null on the wire.
Sourcefn divisible_by(self, step: Self) -> bool
fn divisible_by(self, step: Self) -> bool
multipleOf: whether dividing by step leaves a whole number.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".