Struct fog_pack::validator::TimeValidator [−][src]
Validator for timestamps.
This validator will only pass timestamps. Validation passes if:
- If the
inlist is not empty, the timestamp must be among the timestamp in the list. - The timestamp must not be among the timestamp in the
ninlist. - The timestamp is less than the maximum in
max, or equal to it ifex_maxis not set to true. - The timestamp is greater than the minimum in
min, or equal to it ifex_minis not set to true.
Defaults
Fields that aren’t specified for the validator use their defaults instead. The defaults for each field are:
- comment: “”
- max: maximum possible timestamp
- min: minimum possible timestamp
- ex_max: false
- ex_min: false
- in_list: empty
- nin_list: empty
- query: false
- ord: false
Fields
comment: StringAn optional comment explaining the validator.
max: TimestampThe maximum allowed timestamp.
min: TimestampThe minimum allowed timestamp.
ex_max: boolChanges max into an exclusive maximum.
ex_min: boolChanges min into an exclusive maximum.
in_list: Vec<Timestamp>A vector of specific allowed values, stored under the in field. If empty, this vector is not checked against.
nin_list: Vec<Timestamp>A vector of specific unallowed values, stored under the nin field.
query: boolIf true, queries against matching spots may have values in the in or nin lists.
ord: boolIf true, queries against matching spots may set the max, min, ex_max, and ex_min
values to non-defaults.
Implementations
impl TimeValidator[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: impl Into<Timestamp>) -> Self[src]
Set the maximum allowed value.
pub fn min(self, min: impl Into<Timestamp>) -> 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: impl Into<Timestamp>) -> Self[src]
Add a value to the in list.
pub fn nin_add(self, add: impl Into<Timestamp>) -> 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.
pub fn build(self) -> Validator[src]
Build this into a Validator enum.
Trait Implementations
impl Clone for TimeValidator[src]
fn clone(&self) -> TimeValidator[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for TimeValidator[src]
impl Default for TimeValidator[src]
impl<'de> Deserialize<'de> for TimeValidator where
TimeValidator: Default, [src]
TimeValidator: Default,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl PartialEq<TimeValidator> for TimeValidator[src]
fn eq(&self, other: &TimeValidator) -> bool[src]
fn ne(&self, other: &TimeValidator) -> bool[src]
impl Serialize for TimeValidator[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralPartialEq for TimeValidator[src]
Auto Trait Implementations
impl RefUnwindSafe for TimeValidator
impl Send for TimeValidator
impl Sync for TimeValidator
impl Unpin for TimeValidator
impl UnwindSafe for TimeValidator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,