aboutsummaryrefslogtreecommitdiffstats
path: root/validator_derive/tests/run-pass/custom.rs
blob: f745de65ab28507c537c1d388f579322dd973570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![feature(attr_literals)]

#[macro_use] extern crate validator_derive;
extern crate validator;
use validator::{Validate, ValidationError};

#[derive(Validate)]
struct Test {
    #[validate(custom = "crate::validate_something")]
    s: String,
}

#[derive(Validate)]
struct TestPath {
    #[validate(custom = "crate::validate_something")]
    s: String,
}

fn validate_something(s: &str) -> Result<(), ValidationError> {
    Ok(())
}

fn main() {}