vts 1.1.2

Macro to generate boiler plate to define new types with associated constraints
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use vts::vts;

vts! {
    /// HexaString is a string where all the characters are
    /// valid hexadecimal characters.
    pub(self)
    type HexaString = String
        where self.chars().all(|c| c.is_ascii_hexdigit());
}

fn main() {
    let hexa_string = HexaString::new("01AaB9".to_owned()).unwrap();

    println!("hexa string: {:?}", *hexa_string);
}