try to reduce space usage in ApiStringFormat by using Box

This commit is contained in:
Dietmar Maurer 2018-11-07 13:01:14 +01:00
parent abbf40fc2e
commit 0a33b12851
1 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ pub const DEFAULTSTRING: JssString = JssString {
#[derive(Debug)]
pub enum ApiStringFormat {
None,
Pattern(Regex),
Pattern(Box<Regex>),
Complex(Box<Jss>),
}
@ -339,7 +339,7 @@ fn test_query_string() {
let schema = parameter!{name => ApiString!{
optional => false,
format => ApiStringFormat::Pattern(Regex::new("test").unwrap())
format => ApiStringFormat::Pattern(Box::new(Regex::new("test").unwrap()))
}};
let res = parse_query_string("name=abcd", &schema, true);
@ -350,7 +350,7 @@ fn test_query_string() {
let schema = parameter!{name => ApiString!{
optional => false,
format => ApiStringFormat::Pattern(Regex::new("^test$").unwrap())
format => ApiStringFormat::Pattern(Box::new(Regex::new("^test$").unwrap()))
}};
let res = parse_query_string("name=ateststring", &schema, true);