{"action":"created","issue":{"url":"https://api.github.com/repos/iceiix/steven/issues/57","repository_url":"https://api.github.com/repos/iceiix/steven","labels_url":"https://api.github.com/repos/iceiix/steven/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/iceiix/steven/issues/57/comments","events_url":"https://api.github.com/repos/iceiix/steven/issues/57/events","html_url":"https://github.com/iceiix/steven/pull/57","id":387109813,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1NjcyMjg0","number":57,"title":"1.8.9 (47) multiprotocol support","user":{"login":"iceiix","id":43691553,"node_id":"MDQ6VXNlcjQzNjkxNTUz","avatar_url":"https://avatars0.githubusercontent.com/u/43691553?v=4","gravatar_id":"","url":"https://api.github.com/users/iceiix","html_url":"https://github.com/iceiix","followers_url":"https://api.github.com/users/iceiix/followers","following_url":"https://api.github.com/users/iceiix/following{/other_user}","gists_url":"https://api.github.com/users/iceiix/gists{/gist_id}","starred_url":"https://api.github.com/users/iceiix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iceiix/subscriptions","organizations_url":"https://api.github.com/users/iceiix/orgs","repos_url":"https://api.github.com/users/iceiix/repos","events_url":"https://api.github.com/users/iceiix/events{/privacy}","received_events_url":"https://api.github.com/users/iceiix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":26,"created_at":"2018-12-04T03:59:52Z","updated_at":"2018-12-09T16:44:59Z","closed_at":null,"author_association":"OWNER","pull_request":{"url":"https://api.github.com/repos/iceiix/steven/pulls/57","html_url":"https://github.com/iceiix/steven/pull/57","diff_url":"https://github.com/iceiix/steven/pull/57.diff","patch_url":"https://github.com/iceiix/steven/pull/57.patch"},"body":"http://wiki.vg/index.php?title=Protocol&oldid=7368\r\nhttps://wiki.vg/Protocol_version_numbers#Versions_after_the_Netty_rewrite\r\nhttps://wiki.vg/Protocol_History#1.8\r\nhttps://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.8/protocol.json\r\n\r\nBorrows from https://github.com/iceiix/steven/pull/37 1.8.x protocol support (47)\r\nPart of https://github.com/iceiix/steven/issues/18 Enhance protocol support\r\n\r\n- [x] Packet changes\r\n- [x] Metadata changes\r\n- [x] Support both chunk formats (1.8/1.9+)\r\n- [x] Working chunk format parsing\r\n- [ ] Support both metadata formats (1.8/1.9+)\r\n"},"comment":{"url":"https://api.github.com/repos/iceiix/steven/issues/comments/445552423","html_url":"https://github.com/iceiix/steven/pull/57#issuecomment-445552423","issue_url":"https://api.github.com/repos/iceiix/steven/issues/57","id":445552423,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTU1MjQyMw==","user":{"login":"iceiix","id":43691553,"node_id":"MDQ6VXNlcjQzNjkxNTUz","avatar_url":"https://avatars0.githubusercontent.com/u/43691553?v=4","gravatar_id":"","url":"https://api.github.com/users/iceiix","html_url":"https://github.com/iceiix","followers_url":"https://api.github.com/users/iceiix/followers","following_url":"https://api.github.com/users/iceiix/following{/other_user}","gists_url":"https://api.github.com/users/iceiix/gists{/gist_id}","starred_url":"https://api.github.com/users/iceiix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iceiix/subscriptions","organizations_url":"https://api.github.com/users/iceiix/orgs","repos_url":"https://api.github.com/users/iceiix/repos","events_url":"https://api.github.com/users/iceiix/events{/privacy}","received_events_url":"https://api.github.com/users/iceiix/received_events","type":"User","site_admin":false},"created_at":"2018-12-09T16:44:59Z","updated_at":"2018-12-09T16:44:59Z","author_association":"OWNER","body":"Duplicating the Metadata struct into Metadata18/Metadata19 versions works, but is repetitive, surely there is a better way to structure this code. \r\n\r\nIt is possible to define type aliases using the `type` keyword: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#creating-type-synonyms-with-type-aliases\r\n\r\n```rust\r\ntype Metadata18 = Metadata;\r\ntype Metadata19 = Metadata;\r\n```\r\n\r\nbut both `impl Serializable for Metadata19 {` and `impl Serializable for Metadata18 {` can't exist, they conflict, it is only renaming the type. The way to do specialization seems to be using enums, something like:\r\n\r\n```rust\r\npub enum Metadata {\r\n    V1_8 { map: HashMap<i32, Value>, },\r\n    V1_9 { map: HashMap<i32, Value>, },\r\n}\r\n```\r\n\r\nsee https://stackoverflow.com/questions/32736170/what-is-the-best-way-to-inherit-a-struct-in-rust-1-3\r\n\r\n> Short answer, you can't do inheritance with structs.\r\n>\r\n> Instead of inheritance, Rust uses composition. However, you can do inheritance within traits. Traits don't have data, but they can define functions, so you can many of the benefits of inheritance by using them:\r\n\r\n```rust\r\ntrait Foo {\r\n    fn foo(&self);\r\n}\r\n\r\ntrait FooBar: Foo {\r\n    fn foobar(&self);\r\n}\r\n```\r\n\r\nand http://smallcultfollowing.com/babysteps/blog/2015/05/05/where-rusts-enum-shines/ Virtual Structs Part 1: Where Rust's enum shines"}}
{"actor":{"display_login":"iceiix"}}