Struct fog_pack::validator::F32Validator[][src]

pub struct F32Validator {
    pub comment: String,
    pub max: f32,
    pub min: f32,
    pub ex_max: bool,
    pub ex_min: bool,
    pub in_list: Vec<f32>,
    pub nin_list: Vec<f32>,
    pub query: bool,
    pub ord: bool,
}

Validator for 32-bit floating-point values.

This validator will only pass f32 values. Validation passes if:

  • If max is a number, that the value is less than the maximum in max, or equal to it if ex_max is not set to true.
  • If min is a number, that the value is greater than the minimum in min, or equal to it if ex_min is not set to true.
  • If the in list is not empty, the value must be among the values in it. This performs an exact bit-wise match.
  • The value must not be among the values in the nin list. This performas an exact bit-wise match.

Defaults

Fields that aren’t specified for the validator use their defaults instead. The defaults for each field are:

  • comment: “”
  • max: NaN
  • min: NaN
  • ex_max: false
  • ex_min: false
  • in_list: empty
  • nin_list: empty
  • query: false
  • ord: false

Fields

comment: String

An optional comment explaining the validator.

max: f32

The maximum allowed f32 value. If NaN, it is ignored.

min: f32

The minimum allowed f32 value. If NaN, it is ignored.

ex_max: bool

Changes max into an exclusive maximum.

ex_min: bool

Changes min into an exclusive maximum.

in_list: Vec<f32>

A vector of specific allowed values, stored under the in field. If empty, this vector is not checked against.

nin_list: Vec<f32>

A vector of specific unallowed values, stored under the nin field.

query: bool

If true, queries against matching spots may have values in the in or nin lists.

ord: bool

If true, queries against matching spots may set the max, min, ex_max, and ex_min values to non-defaults.

Implementations

impl F32Validator[src]

pub fn new() -> Self[src]

Make a new validator with the default configuration.

pub fn comment(self, comment: impl Into<String>) -> Self[src]

Set a comment for the validator.

pub fn max(self, max: f32) -> Self[src]

Set the maximum allowed value.

pub fn min(self, min: f32) -> Self[src]

Set the minimum allowed value.

pub fn ex_max(self, ex_max: bool) -> Self[src]

Set whether or or not max is an exclusive maximum.

pub fn ex_min(self, ex_min: bool) -> Self[src]

Set whether or or not min is an exclusive maximum.

pub fn in_add(self, add: f32) -> Self[src]

Add a value to the in list.

pub fn nin_add(self, add: f32) -> Self[src]

Add a value to the nin list.

pub fn query(self, query: bool) -> Self[src]

Set whether or not queries can use the in and nin lists.

pub fn ord(self, ord: bool) -> Self[src]

Set whether or not queries can use the max, min, ex_max, and ex_min values.

Trait Implementations

impl Clone for F32Validator[src]

impl Debug for F32Validator[src]

impl Default for F32Validator[src]

impl<'de> Deserialize<'de> for F32Validator where
    F32Validator: Default
[src]

impl PartialEq<F32Validator> for F32Validator[src]

impl Serialize for F32Validator[src]

impl StructuralPartialEq for F32Validator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,