2 unstable releases
Uses old Rust 2015
0.2.0 | Jan 21, 2018 |
---|---|
0.1.0 | Sep 16, 2017 |
#40 in #ref
4KB
example
cargo.toml
[dependencies]
str_to_enum_derive = "0.2.0"
main.rs
#[macro_use]
extern crate str_to_enum_derive;
#[derive(StrToEnum, Debug, PartialEq, Eq)]
enum HTTPMethod {
GET,
HEAD,
POST,
PUT,
DELETE,
CONNECT,
OPTIONS,
TRACE
}
fn main() {
assert_eq!(HTTPMethod::GET, "GET".parse::<HTTPMethod>().unwrap());
assert_eq!(HTTPMethod::HEAD, "HEAD".parse::<HTTPMethod>().unwrap());
}
Dependencies
~2MB
~48K SLoC