Zisvalidator
Zisvalidator is designed for validating input struct or enum in web or other scence.
Reference to Serde and Validator.
EXAMPLE
Validate for Struct and Enum
; //validate tuple struct with 1 element
; //validate tuple struct with mulitple elements
Validate Arrribute
Container Attribute
-
#[validate(schema = "foo")]
Validate type T by customer by function
fooasFn(t:T) -> Result<(),ValidatorError) -
#[validate(custom = "foo")]
Valid for tuple struct.For example,for type
struct S(String,String),validate by functionfooasFn(t:&String) -> Result<(),ValidatorError> -
#[validate(range = "start..end")]
Valid for tuple struct.Validate for elements' range.
Field Attribute
-
#[validate(range = "start..end")]
Validate for fields' range.
-
#[validate(custom = "foo")]
Validate by function
fooasFn(t:&T) -> Result<(),ValidatorError>.
Variant Attribute
-
#[validate(range = "start..end")]
Validate for variants' range.
-
#[validate(custom = "foo")]
Validate by function
fooasFn(t:&T) -> Result<(),ValidatorError>.