{"action":"created","issue":{"url":"https://api.github.com/repos/BurntSushi/rust-csv/issues/76","repository_url":"https://api.github.com/repos/BurntSushi/rust-csv","labels_url":"https://api.github.com/repos/BurntSushi/rust-csv/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/BurntSushi/rust-csv/issues/76/comments","events_url":"https://api.github.com/repos/BurntSushi/rust-csv/issues/76/events","html_url":"https://github.com/BurntSushi/rust-csv/issues/76","id":231612921,"number":76,"title":"The trait `serde::ser::Serialize` is not implemented for `csv::ByteRecord`","user":{"login":"emk","id":36963,"avatar_url":"https://avatars1.githubusercontent.com/u/36963?v=3","gravatar_id":"","url":"https://api.github.com/users/emk","html_url":"https://github.com/emk","followers_url":"https://api.github.com/users/emk/followers","following_url":"https://api.github.com/users/emk/following{/other_user}","gists_url":"https://api.github.com/users/emk/gists{/gist_id}","starred_url":"https://api.github.com/users/emk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emk/subscriptions","organizations_url":"https://api.github.com/users/emk/orgs","repos_url":"https://api.github.com/users/emk/repos","events_url":"https://api.github.com/users/emk/events{/privacy}","received_events_url":"https://api.github.com/users/emk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-26T12:26:58Z","updated_at":"2017-05-26T12:52:38Z","closed_at":"2017-05-26T12:52:38Z","body":"Hello! I'm trying out the new `csv` beta release on some of in-house data-munging tools, and it's great.\r\n\r\nBut I did discover one tiny way to improve the ergonomics:\r\n\r\n```rust\r\n        // Use `byte_records` to get raw binary data without UTF-8 validation\r\n        // for speed, since we may have enormous numbers of rows and hundreds of\r\n        // columns.\r\n        for row in rdr.byte_records() {\r\n            let mut row = row?;\r\n            let zip = from_utf8(&row[zip_col_idx])\r\n                .chain_err(|| -> Error { \"Could not parse zip code as UTF-8\".into() })?\r\n                .to_owned();\r\n            row.push_field(self.chunk_for(&zip)?.as_bytes());\r\n            wtr.serialize(&row)?;\r\n        }\r\n```\r\n\r\nThe above code has no idea what the columns are in any given record, except for `zip_col_idx`, which it uses to compute a new column and add it to the output row. But this code fails with:\r\n\r\n```\r\nerror[E0277]: the trait bound `csv::ByteRecord: serde::ser::Serialize` is not satisfied\r\n   --> src/zip2010.rs:101:17\r\n    |\r\n101 |             wtr.serialize(&row)?;\r\n    |                 ^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `csv::ByteRecord`\r\n    |\r\n    = note: required because of the requirements on the impl of `serde::ser::Serialize` for `&csv::ByteRecord`\r\n```\r\n\r\nThis turns up in a lot of places in the API when working with generic CSV tools. I suspect one way to improve this might be to implement `Serialize` and `Deserialize` for both `ByteRecord` and `Record`.\r\n\r\nI might be able to find time sometime soon to put together a PR. But is there a better way to fix this?"},"comment":{"url":"https://api.github.com/repos/BurntSushi/rust-csv/issues/comments/304275108","html_url":"https://github.com/BurntSushi/rust-csv/issues/76#issuecomment-304275108","issue_url":"https://api.github.com/repos/BurntSushi/rust-csv/issues/76","id":304275108,"user":{"login":"emk","id":36963,"avatar_url":"https://avatars1.githubusercontent.com/u/36963?v=3","gravatar_id":"","url":"https://api.github.com/users/emk","html_url":"https://github.com/emk","followers_url":"https://api.github.com/users/emk/followers","following_url":"https://api.github.com/users/emk/following{/other_user}","gists_url":"https://api.github.com/users/emk/gists{/gist_id}","starred_url":"https://api.github.com/users/emk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emk/subscriptions","organizations_url":"https://api.github.com/users/emk/orgs","repos_url":"https://api.github.com/users/emk/repos","events_url":"https://api.github.com/users/emk/events{/privacy}","received_events_url":"https://api.github.com/users/emk/received_events","type":"User","site_admin":false},"created_at":"2017-05-26T12:52:38Z","updated_at":"2017-05-26T12:52:38Z","body":"> Does that make sense or am I missing something else about your use case?\r\n\r\nI think it's _me_ who missed the relevant sections of the new documentation while porting code forward. :-/ Sorry about that. I'll go re-read the documentation more carefully this time. Thank you for the pointer in the right direction!"}}
{"actor":{"display_login":"emk"}}