Added NewType variant to example.

This commit is contained in:
Azriel Hoh 2018-10-10 09:16:03 +13:00
parent f5d14af5a6
commit 9a69c17a4e

View file

@ -14,6 +14,7 @@ struct Config {
// tuple: MyEnum, // tuple: MyEnum,
#[serde(rename = "struct")] #[serde(rename = "struct")]
structv: MyEnum, structv: MyEnum,
newtype: MyEnum,
my_enum: Vec<MyEnum>, my_enum: Vec<MyEnum>,
} }
@ -21,6 +22,7 @@ struct Config {
enum MyEnum { enum MyEnum {
Plain, Plain,
Tuple(i64, bool), Tuple(i64, bool),
NewType(String),
Struct { value: i64 }, Struct { value: i64 },
} }
@ -29,9 +31,11 @@ fn main() {
plain = "Plain" plain = "Plain"
# tuple = { 0 = 123, 1 = true } # tuple = { 0 = 123, 1 = true }
struct = { Struct = { value = 123 } } struct = { Struct = { value = 123 } }
newtype = { NewType = "value" }
my_enum = [ my_enum = [
{ Plain = {} }, { Plain = {} },
# { Tuple = { 0 = 123, 1 = true } }, # { Tuple = { 0 = 123, 1 = true } },
{ NewType = "value" },
{ Struct = { value = 123 } } { Struct = { value = 123 } }
]"#; ]"#;