From 9ce37a6b0278d4c422e5cac7003cf908cc2c9e3f Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Wed, 10 Oct 2018 11:36:46 +1300 Subject: Implemented enum tuple deserialization. Issue #225 --- examples/enum_external.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/enum_external.rs b/examples/enum_external.rs index 095dca5..e2ac4f8 100644 --- a/examples/enum_external.rs +++ b/examples/enum_external.rs @@ -11,7 +11,8 @@ extern crate serde_derive; #[derive(Debug, Deserialize)] struct Config { plain: MyEnum, - // tuple: MyEnum, + plain_table: MyEnum, + tuple: MyEnum, #[serde(rename = "struct")] structv: MyEnum, newtype: MyEnum, @@ -29,12 +30,13 @@ enum MyEnum { fn main() { let toml_str = r#" plain = "Plain" - # tuple = { 0 = 123, 1 = true } + plain_table = { Plain = {} } + tuple = { Tuple = { 0 = 123, 1 = true } } struct = { Struct = { value = 123 } } newtype = { NewType = "value" } my_enum = [ { Plain = {} }, - # { Tuple = { 0 = 123, 1 = true } }, + { Tuple = { 0 = 123, 1 = true } }, { NewType = "value" }, { Struct = { value = 123 } } ]"#; -- cgit v1.2.3