{"action":"opened","issue":{"url":"https://api.github.com/repos/ebfull/pcap/issues/98","repository_url":"https://api.github.com/repos/ebfull/pcap","labels_url":"https://api.github.com/repos/ebfull/pcap/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/ebfull/pcap/issues/98/comments","events_url":"https://api.github.com/repos/ebfull/pcap/issues/98/events","html_url":"https://github.com/ebfull/pcap/issues/98","id":357106785,"node_id":"MDU6SXNzdWUzNTcxMDY3ODU=","number":98,"title":"Write `pcap::Packet` to file without `Savefile`","user":{"login":"rossmacarthur","id":17109887,"node_id":"MDQ6VXNlcjE3MTA5ODg3","avatar_url":"https://avatars3.githubusercontent.com/u/17109887?v=4","gravatar_id":"","url":"https://api.github.com/users/rossmacarthur","html_url":"https://github.com/rossmacarthur","followers_url":"https://api.github.com/users/rossmacarthur/followers","following_url":"https://api.github.com/users/rossmacarthur/following{/other_user}","gists_url":"https://api.github.com/users/rossmacarthur/gists{/gist_id}","starred_url":"https://api.github.com/users/rossmacarthur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rossmacarthur/subscriptions","organizations_url":"https://api.github.com/users/rossmacarthur/orgs","repos_url":"https://api.github.com/users/rossmacarthur/repos","events_url":"https://api.github.com/users/rossmacarthur/events{/privacy}","received_events_url":"https://api.github.com/users/rossmacarthur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-05T07:51:49Z","updated_at":"2018-09-05T07:51:49Z","closed_at":null,"author_association":"NONE","body":"I wanted to append a `pcap::Packet` to a file in pcap format without using `Savefile`. \r\n\r\nCurrently doing something like this\r\n\r\n```rust\r\nunsafe fn any_as_u8_slice<T: Sized>(p: &T) -> &[u8] {\r\n    slice::from_raw_parts((p as *const T) as *const u8, mem::size_of::<T>())\r\n}\r\n\r\nunsafe {\r\n    temp.write_all(any_as_u8_slice(&(packet.header.ts.tv_sec as u32))).unwrap();\r\n    temp.write_all(any_as_u8_slice(&(packet.header.ts.tv_usec as u32))).unwrap();\r\n    temp.write_all(any_as_u8_slice(&packet.header.caplen)).unwrap();\r\n    temp.write_all(any_as_u8_slice(&packet.header.len)).unwrap();\r\n}\r\ntemp.write_all(&packet.data).unwrap();\r\n"}}
{"actor":{"display_login":"rossmacarthur"}}