{"action":"closed","issue":{"url":"https://api.github.com/repos/dtolnay/serde-yaml/issues/15","repository_url":"https://api.github.com/repos/dtolnay/serde-yaml","labels_url":"https://api.github.com/repos/dtolnay/serde-yaml/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/dtolnay/serde-yaml/issues/15/comments","events_url":"https://api.github.com/repos/dtolnay/serde-yaml/issues/15/events","html_url":"https://github.com/dtolnay/serde-yaml/issues/15","id":156115837,"number":15,"title":"Parsing a unit enum value as a String rather than a HashMap","user":{"login":"Lindenk","id":2438655,"avatar_url":"https://avatars.githubusercontent.com/u/2438655?v=3","gravatar_id":"","url":"https://api.github.com/users/Lindenk","html_url":"https://github.com/Lindenk","followers_url":"https://api.github.com/users/Lindenk/followers","following_url":"https://api.github.com/users/Lindenk/following{/other_user}","gists_url":"https://api.github.com/users/Lindenk/gists{/gist_id}","starred_url":"https://api.github.com/users/Lindenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lindenk/subscriptions","organizations_url":"https://api.github.com/users/Lindenk/orgs","repos_url":"https://api.github.com/users/Lindenk/repos","events_url":"https://api.github.com/users/Lindenk/events{/privacy}","received_events_url":"https://api.github.com/users/Lindenk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-21T18:41:01Z","updated_at":"2016-05-22T08:06:42Z","closed_at":"2016-05-22T08:06:42Z","body":"Currently, when parsing an enum type, any Values must be a HashMap:\r\n\r\n`main.rs`:\r\n```rust\r\n#![feature(custom_derive, plugin)]\r\n#![plugin(serde_macros)]\r\n\r\n#[macro_use]\r\nextern crate serde;\r\nextern crate serde_yaml;\r\n\r\nuse std::fs::File;\r\n\r\n\r\n#[derive(Serialize, Deserialize, Debug)]\r\nenum Beans {\r\n    Blue,\r\n    Black,\r\n    Chamomile\r\n}\r\n\r\n#[derive(Serialize, Deserialize, Debug)]\r\nstruct Food {\r\n    beans : Beans\r\n}\r\n\r\nfn main() {\r\n    let f = File::open(\"test_yaml.yaml\").unwrap();\r\n    let test : Food = serde_yaml::from_reader(f).unwrap();\r\n    \r\n    println!(\"{:?}\", test);\r\n}\r\n```\r\n\r\n`test_yaml.yaml`:\r\n```yaml\r\nbeans:\r\n    Blue: ()\r\n```\r\n\r\nThis would will parse `Blue` into `test`. However, it is inconvenient to require all unit enum values to have associated non-existent data. Instead, if the value is a unit value, it should also be parsable as a string.\r\n\r\n```yaml\r\nbeans: Blue\r\n```"}}
{"actor":{"display_login":"dtolnay"}}