pub struct MultiValidator(pub Vec<Validator>);Expand description
“Multi” validator that checks with several validators at once.
This validator will accept any value that passes at least one of its contained validators. This can be used like an “any of” operator, or a logical OR of validators.
When this validator is used, the contained validators are checked in order, passing when the
first contained validator passes. When performing Entry validation, this can mean that a
linked document may be added to the list of documents needed for final validation, even if
another contained validator (later in the list) would also pass without it.
When going through the contained validators, some rules are followed to avoid possible cyclic references:
- Contained Multi-validators are skipped
- Contained Ref validators that refer to a Multi-validator are skipped.
- Contained Ref validators that refer to a Ref validator are skipped.
More succintly, the banned sequences are: Multi->Multi, Multi->Ref->Multi, Multi->Ref->Ref.
§Query Checking
The validator for a query must be accepted by at least one of the validators in the Multi-validator. Contained validators that violate the cyclic reference rules are skipped (see above).
Tuple Fields§
§0: Vec<Validator>Implementations§
Trait Implementations§
Source§impl Clone for MultiValidator
impl Clone for MultiValidator
Source§fn clone(&self) -> MultiValidator
fn clone(&self) -> MultiValidator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MultiValidator
impl Debug for MultiValidator
Source§impl Default for MultiValidator
impl Default for MultiValidator
Source§fn default() -> MultiValidator
fn default() -> MultiValidator
Source§impl<'de> Deserialize<'de> for MultiValidator
impl<'de> Deserialize<'de> for MultiValidator
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MultiValidator
impl PartialEq for MultiValidator
Source§fn eq(&self, other: &MultiValidator) -> bool
fn eq(&self, other: &MultiValidator) -> bool
self and other values to be equal, and is used by ==.