Conversion from enum to owned string

This commit is contained in:
Pantonshire committed 2021-05-18 16:37:41 +01:00
1 parent 1a6feab1f2
commit bfc8a82627
4 files changed
+143 -45

No files matched your search

+8 -2
View File
@@ -5,12 +5,18 @@ extern crate enumscribe;
enum Foo {
#[enumscribe(str = "b", case_insensitive)]
Baa,
#[enumscribe(ignore)]
// #[enumscribe(ignore)]
Baz(),
#[enumscribe(other)]
Lorem { inner: String }
}
fn main() {
println!("Hello world!");
let foo = Foo::Baa;
// let s: String = foo.into();
let s: String = <_ as std::convert::Into<String>>::into(foo);
println!("Hello, {}!", s);
}