implement FromParam for bool

This commit is contained in:
marcelbuesing 2018-07-03 10:32:20 +02:00
parent b6d26c9faf
commit e225825387
No known key found for this signature in database
GPG Key ID: E51C4F8A2B7FF43E
1 changed files with 13 additions and 0 deletions

View File

@ -240,6 +240,7 @@ macro_rules! FROM_STR {
};
}
FROM_STR!(bool);
FROM_STR!(u8);
FROM_STR!(u16);
FROM_STR!(u32);
@ -296,4 +297,16 @@ mod tests {
Ok(PathBuf::from_iter(vec!["seg2"]))
);
}
#[test]
fn test_from_param() {
assert_eq!(
<bool as FromParam>::from_param("true").unwrap(),
true
);
assert_eq!(
<bool as FromParam>::from_param("false").unwrap(),
false
);
}
}