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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more