This commit is contained in:
Marcel Buesing 2018-07-05 01:05:06 +00:00 committed by GitHub
commit b48bc746b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -236,6 +236,7 @@ macro_rules! FROM_STR {
}; };
} }
FROM_STR!(bool);
FROM_STR!(u8); FROM_STR!(u8);
FROM_STR!(u16); FROM_STR!(u16);
FROM_STR!(u32); FROM_STR!(u32);
@ -292,4 +293,16 @@ mod tests {
Ok(PathBuf::from_iter(vec!["seg2"])) 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
);
}
} }