Derives for scribe static cow str

This commit is contained in:
Pantonshire committed 2021-05-19 11:56:23 +01:00
1 parent 0c4c252be9
commit 95683c7ce7
2 files changed
+137 -9

No files matched your search

+6 -3
View File
@@ -1,7 +1,8 @@
use enumscribe::*;
// #[derive(ScribeString)]
#[derive(TryScribeString)]
#[derive(TryScribeCowStr)]
enum Airport {
#[enumscribe(str = "LHR", case_insensitive)]
Heathrow,
@@ -17,6 +18,8 @@ enum Airport {
fn main() {
let luton = Airport::Luton;
let luton_string = luton.try_scribe();
println!("Hello, {:?}!", luton_string);
println!("Hello, {:?}!", luton.try_scribe());
let other = Airport::Other("Dedicated EasyJet-only airport".to_owned());
println!("Hello, {:?}!", other.try_scribe());
}