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
399 B
Rust
23 lines
399 B
Rust
#[macro_use]
|
|
extern crate enumscribe;
|
|
|
|
#[derive(EnumToString)]
|
|
enum Foo {
|
|
#[enumscribe(str = "b", case_insensitive)]
|
|
Baa,
|
|
// #[enumscribe(ignore)]
|
|
Baz(),
|
|
#[enumscribe(other)]
|
|
Lorem { inner: String }
|
|
}
|
|
|
|
fn main() {
|
|
let foo = Foo::Baa;
|
|
|
|
// let s: String = foo.into();
|
|
|
|
let s: String = <_ as std::convert::Into<String>>::into(foo);
|
|
|
|
println!("Hello, {}!", s);
|
|
}
|