aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAzriel Hoh <azriel91@gmail.com>2018-10-10 11:36:46 +1300
committerAzriel Hoh <azriel91@gmail.com>2018-11-10 11:07:23 +1300
commit9ce37a6b0278d4c422e5cac7003cf908cc2c9e3f (patch)
tree1ac8b4f500df6ff995668b9075d1c25ee39a3fdc /examples
parentb6559e9e8dbbe2d9dacc1b5960541315a9765816 (diff)
downloadmilf-rs-9ce37a6b0278d4c422e5cac7003cf908cc2c9e3f.tar.gz
milf-rs-9ce37a6b0278d4c422e5cac7003cf908cc2c9e3f.zip
Implemented enum tuple deserialization.
Issue #225
Diffstat (limited to 'examples')
-rw-r--r--examples/enum_external.rs8
1 files changed, 5 insertions, 3 deletions
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 } }
]"#;