This commit is contained in:
Pantonshire committed 2021-05-19 17:54:34 +01:00
1 parent fce589369b
commit ed83ffc5f3
4 files changed
+215 -284

No files matched your search

+5 -7
View File
@@ -1,8 +1,6 @@
use enumscribe::*;
// #[derive(ScribeString)]
#[derive(TryScribeStaticStr)]
#[derive(TryScribeCowStr)]
enum Airport {
#[enumscribe(str = "LHR", case_insensitive)]
Heathrow,
@@ -12,14 +10,14 @@ enum Airport {
Luton,
#[enumscribe(str = "BHX", case_insensitive, ignore)]
BirminghamInternational,
// #[enumscribe(other)]
// Other(String),
#[enumscribe(other)]
Other(String),
}
fn main() {
let luton = Airport::Luton;
println!("Hello, {:?}!", luton.try_scribe());
// let other = Airport::Other("Dedicated EasyJet-only airport".to_owned());
// println!("Hello, {:?}!", other.try_scribe());
let other = Airport::Other("Dedicated EasyJet-only airport".to_owned());
println!("Hello, {:?}!", other.try_scribe());
}