You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
515 B
Rust
23 lines
515 B
Rust
#[macro_use]
|
|
extern crate enumscribe;
|
|
|
|
#[derive(EnumToString)]
|
|
enum Airport {
|
|
#[enumscribe(str = "LHR", case_insensitive)]
|
|
Heathrow,
|
|
#[enumscribe(str = "LGW", case_insensitive)]
|
|
Gatwick,
|
|
#[enumscribe(str = "LTN", case_insensitive)]
|
|
Luton,
|
|
#[enumscribe(str = "BHX", case_insensitive)]
|
|
BirminghamInternational,
|
|
#[enumscribe(other)]
|
|
Other(String),
|
|
}
|
|
|
|
fn main() {
|
|
let luton = Airport::Luton;
|
|
let luton_str: String = luton.into();
|
|
println!("Hello, {}!", luton_str);
|
|
}
|