Scribe static str, documentation

This commit is contained in:
Pantonshire committed 2021-05-19 16:12:57 +01:00
1 parent 95683c7ce7
commit 56d790559e
3 files changed
+216 -11

No files matched your search

+5 -5
View File
@@ -2,7 +2,7 @@ use enumscribe::*;
// #[derive(ScribeString)]
#[derive(TryScribeCowStr)]
#[derive(TryScribeStaticStr)]
enum Airport {
#[enumscribe(str = "LHR", case_insensitive)]
Heathrow,
@@ -12,14 +12,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());
}