{"action":"created","comment":{"url":"https://api.github.com/repos/Nemo157/html-event/pulls/comments/57575315","id":57575315,"diff_hunk":"@@ -0,0 +1,63 @@\n+use std::io;\n+use std::io::Write;\n+use std::marker::PhantomData;\n+use Event;\n+\n+pub struct ReadHtml<'a, I> where I: Iterator<Item=Event<'a>> + 'a {\n+    events: I,\n+    current: Vec<u8>,\n+    phantom: PhantomData<&'a I>,\n+}\n+\n+impl<'a, I> ReadHtml<'a, I> where I: Iterator<Item=Event<'a>> {\n+    pub fn new<II>(events: II) -> ReadHtml<'a, I> where II: IntoIterator<IntoIter=I, Item=Event<'a>> {\n+        ReadHtml {\n+            events: events.into_iter(),\n+            current: Vec::new(),\n+            phantom: PhantomData,\n+        }\n+    }\n+}\n+\n+impl<'a, I> io::Read for ReadHtml<'a, I> where I: Iterator<Item=Event<'a>> {\n+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {\n+        // TODO handle buf.len() == 0","path":"src/read.rs","position":24,"original_position":24,"commit_id":"d42cba555f4e7c35c821dfe935fe287576cf4a59","original_commit_id":"d42cba555f4e7c35c821dfe935fe287576cf4a59","user":{"login":"Nemo157","id":81079,"avatar_url":"https://avatars.githubusercontent.com/u/81079?v=3","gravatar_id":"","url":"https://api.github.com/users/Nemo157","html_url":"https://github.com/Nemo157","followers_url":"https://api.github.com/users/Nemo157/followers","following_url":"https://api.github.com/users/Nemo157/following{/other_user}","gists_url":"https://api.github.com/users/Nemo157/gists{/gist_id}","starred_url":"https://api.github.com/users/Nemo157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nemo157/subscriptions","organizations_url":"https://api.github.com/users/Nemo157/orgs","repos_url":"https://api.github.com/users/Nemo157/repos","events_url":"https://api.github.com/users/Nemo157/events{/privacy}","received_events_url":"https://api.github.com/users/Nemo157/received_events","type":"User","site_admin":false},"body":"I think the current implementation handles it fine, from the docs for `io::Read`:\r\n\r\n> If the return value of this method is Ok(n) [...] If n is 0, then it can indicate [...] The buffer specified was 0 bytes in length.","created_at":"2016-03-28T14:14:32Z","updated_at":"2016-03-28T14:14:32Z","html_url":"https://github.com/Nemo157/html-event/pull/2#discussion_r57575315","pull_request_url":"https://api.github.com/repos/Nemo157/html-event/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/Nemo157/html-event/pulls/comments/57575315"},"html":{"href":"https://github.com/Nemo157/html-event/pull/2#discussion_r57575315"},"pull_request":{"href":"https://api.github.com/repos/Nemo157/html-event/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/Nemo157/html-event/pulls/2","id":64297852,"html_url":"https://github.com/Nemo157/html-event/pull/2","diff_url":"https://github.com/Nemo157/html-event/pull/2.diff","patch_url":"https://github.com/Nemo157/html-event/pull/2.patch","issue_url":"https://api.github.com/repos/Nemo157/html-event/issues/2","number":2,"state":"open","locked":false,"title":"Add events and basic macros","user":{"login":"Nemo157","id":81079,"avatar_url":"https://avatars.githubusercontent.com/u/81079?v=3","gravatar_id":"","url":"https://api.github.com/users/Nemo157","html_url":"https://github.com/Nemo157","followers_url":"https://api.github.com/users/Nemo157/followers","following_url":"https://api.github.com/users/Nemo157/following{/other_user}","gists_url":"https://api.github.com/users/Nemo157/gists{/gist_id}","starred_url":"https://api.github.com/users/Nemo157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nemo157/subscriptions","organizations_url":"https://api.github.com/users/Nemo157/orgs","repos_url":"https://api.github.com/users/Nemo157/repos","events_url":"https://api.github.com/users/Nemo157/events{/privacy}","received_events_url":"https://api.github.com/users/Nemo157/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-28T07:41:14Z","updated_at":"2016-03-28T14:14:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16a5f411dcde52c71ce00de85b7169d17eca93b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Nemo157/html-event/pulls/2/commits","review_comments_url":"https://api.github.com/repos/Nemo157/html-event/pulls/2/comments","review_comment_url":"https://api.github.com/repos/Nemo157/html-event/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Nemo157/html-event/issues/2/comments","statuses_url":"https://api.github.com/repos/Nemo157/html-event/statuses/d42cba555f4e7c35c821dfe935fe287576cf4a59","head":{"label":"Nemo157:events","ref":"events","sha":"d42cba555f4e7c35c821dfe935fe287576cf4a59","user":{"login":"Nemo157","id":81079,"avatar_url":"https://avatars.githubusercontent.com/u/81079?v=3","gravatar_id":"","url":"https://api.github.com/users/Nemo157","html_url":"https://github.com/Nemo157","followers_url":"https://api.github.com/users/Nemo157/followers","following_url":"https://api.github.com/users/Nemo157/following{/other_user}","gists_url":"https://api.github.com/users/Nemo157/gists{/gist_id}","starred_url":"https://api.github.com/users/Nemo157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nemo157/subscriptions","organizations_url":"https://api.github.com/users/Nemo157/orgs","repos_url":"https://api.github.com/users/Nemo157/repos","events_url":"https://api.github.com/users/Nemo157/events{/privacy}","received_events_url":"https://api.github.com/users/Nemo157/received_events","type":"User","site_admin":false},"repo":{"id":54832853,"name":"html-event","full_name":"Nemo157/html-event","owner":{"login":"Nemo157","id":81079,"avatar_url":"https://avatars.githubusercontent.com/u/81079?v=3","gravatar_id":"","url":"https://api.github.com/users/Nemo157","html_url":"https://github.com/Nemo157","followers_url":"https://api.github.com/users/Nemo157/followers","following_url":"https://api.github.com/users/Nemo157/following{/other_user}","gists_url":"https://api.github.com/users/Nemo157/gists{/gist_id}","starred_url":"https://api.github.com/users/Nemo157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nemo157/subscriptions","organizations_url":"https://api.github.com/users/Nemo157/orgs","repos_url":"https://api.github.com/users/Nemo157/repos","events_url":"https://api.github.com/users/Nemo157/events{/privacy}","received_events_url":"https://api.github.com/users/Nemo157/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nemo157/html-event","description":"","fork":false,"url":"https://api.github.com/repos/Nemo157/html-event","forks_url":"https://api.github.com/repos/Nemo157/html-event/forks","keys_url":"https://api.github.com/repos/Nemo157/html-event/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nemo157/html-event/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nemo157/html-event/teams","hooks_url":"https://api.github.com/repos/Nemo157/html-event/hooks","issue_events_url":"https://api.github.com/repos/Nemo157/html-event/issues/events{/number}","events_url":"https://api.github.com/repos/Nemo157/html-event/events","assignees_url":"https://api.github.com/repos/Nemo157/html-event/assignees{/user}","branches_url":"https://api.github.com/repos/Nemo157/html-event/branches{/branch}","tags_url":"https://api.github.com/repos/Nemo157/html-event/tags","blobs_url":"https://api.github.com/repos/Nemo157/html-event/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nemo157/html-event/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nemo157/html-event/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nemo157/html-event/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nemo157/html-event/statuses/{sha}","languages_url":"https://api.github.com/repos/Nemo157/html-event/languages","stargazers_url":"https://api.github.com/repos/Nemo157/html-event/stargazers","contributors_url":"https://api.github.com/repos/Nemo157/html-event/contributors","subscribers_url":"https://api.github.com/repos/Nemo157/html-event/subscribers","subscription_url":"https://api.github.com/repos/Nemo157/html-event/subscription","commits_url":"https://api.github.com/repos/Nemo157/html-event/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nemo157/html-event/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nemo157/html-event/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nemo157/html-event/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nemo157/html-event/contents/{+path}","compare_url":"https://api.github.com/repos/Nemo157/html-event/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nemo157/html-event/merges","archive_url":"https://api.github.com/repos/Nemo157/html-event/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nemo157/html-event/downloads","issues_url":"https://api.github.com/repos/Nemo157/html-event/issues{/number}","pulls_url":"https://api.github.com/repos/Nemo157/html-event/pulls{/number}","milestones_url":"https://api.github.com/repos/Nemo157/html-event/milestones{/number}","notifications_url":"https://api.github.com/repos/Nemo157/html-event/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nemo157/html-event/labels{/name}","releases_url":"https://api.github.com/repos/Nemo157/html-event/releases{/id}","deployments_url":"https://api.github.com/repos/Nemo157/html-event/deployments","created_at":"2016-03-27T14:42:35Z","updated_at":"2016-03-28T07:39:05Z","pushed_at":"2016-03-28T13:49:25Z","git_url":"git://github.com/Nemo157/html-event.git","ssh_url":"git@github.com:Nemo157/html-event.git","clone_url":"https://github.com/Nemo157/html-event.git","svn_url":"https://github.com/Nemo157/html-event","homepage":null,"size":17,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"Nemo157:master","ref":"master","sha":"c82781e1171f70b9aec721fe7b4540e2b242b86d","user":{"login":"Nemo157","id":81079,"avatar_url":"https://avatars.githubusercontent.com/u/81079?v=3","gravatar_id":"","url":"https://api.github.com/users/Nemo157","html_url":"https://github.com/Nemo157","followers_url":"https://api.github.com/users/Nemo157/followers","following_url":"https://api.github.com/users/Nemo157/following{/other_user}","gists_url":"https://api.github.com/users/Nemo157/gists{/gist_id}","starred_url":"https://api.github.com/users/Nemo157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nemo157/subscriptions","organizations_url":"https://api.github.com/users/Nemo157/orgs","repos_url":"https://api.github.com/users/Nemo157/repos","events_url":"https://api.github.com/users/Nemo157/events{/privacy}","received_events_url":"https://api.github.com/users/Nemo157/received_events","type":"User","site_admin":false},"repo":{"id":54832853,"name":"html-event","full_name":"Nemo157/html-event","owner":{"login":"Nemo157","id":81079,"avatar_url":"https://avatars.githubusercontent.com/u/81079?v=3","gravatar_id":"","url":"https://api.github.com/users/Nemo157","html_url":"https://github.com/Nemo157","followers_url":"https://api.github.com/users/Nemo157/followers","following_url":"https://api.github.com/users/Nemo157/following{/other_user}","gists_url":"https://api.github.com/users/Nemo157/gists{/gist_id}","starred_url":"https://api.github.com/users/Nemo157/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nemo157/subscriptions","organizations_url":"https://api.github.com/users/Nemo157/orgs","repos_url":"https://api.github.com/users/Nemo157/repos","events_url":"https://api.github.com/users/Nemo157/events{/privacy}","received_events_url":"https://api.github.com/users/Nemo157/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nemo157/html-event","description":"","fork":false,"url":"https://api.github.com/repos/Nemo157/html-event","forks_url":"https://api.github.com/repos/Nemo157/html-event/forks","keys_url":"https://api.github.com/repos/Nemo157/html-event/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nemo157/html-event/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nemo157/html-event/teams","hooks_url":"https://api.github.com/repos/Nemo157/html-event/hooks","issue_events_url":"https://api.github.com/repos/Nemo157/html-event/issues/events{/number}","events_url":"https://api.github.com/repos/Nemo157/html-event/events","assignees_url":"https://api.github.com/repos/Nemo157/html-event/assignees{/user}","branches_url":"https://api.github.com/repos/Nemo157/html-event/branches{/branch}","tags_url":"https://api.github.com/repos/Nemo157/html-event/tags","blobs_url":"https://api.github.com/repos/Nemo157/html-event/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nemo157/html-event/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nemo157/html-event/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nemo157/html-event/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nemo157/html-event/statuses/{sha}","languages_url":"https://api.github.com/repos/Nemo157/html-event/languages","stargazers_url":"https://api.github.com/repos/Nemo157/html-event/stargazers","contributors_url":"https://api.github.com/repos/Nemo157/html-event/contributors","subscribers_url":"https://api.github.com/repos/Nemo157/html-event/subscribers","subscription_url":"https://api.github.com/repos/Nemo157/html-event/subscription","commits_url":"https://api.github.com/repos/Nemo157/html-event/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nemo157/html-event/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nemo157/html-event/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nemo157/html-event/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nemo157/html-event/contents/{+path}","compare_url":"https://api.github.com/repos/Nemo157/html-event/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nemo157/html-event/merges","archive_url":"https://api.github.com/repos/Nemo157/html-event/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nemo157/html-event/downloads","issues_url":"https://api.github.com/repos/Nemo157/html-event/issues{/number}","pulls_url":"https://api.github.com/repos/Nemo157/html-event/pulls{/number}","milestones_url":"https://api.github.com/repos/Nemo157/html-event/milestones{/number}","notifications_url":"https://api.github.com/repos/Nemo157/html-event/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nemo157/html-event/labels{/name}","releases_url":"https://api.github.com/repos/Nemo157/html-event/releases{/id}","deployments_url":"https://api.github.com/repos/Nemo157/html-event/deployments","created_at":"2016-03-27T14:42:35Z","updated_at":"2016-03-28T07:39:05Z","pushed_at":"2016-03-28T13:49:25Z","git_url":"git://github.com/Nemo157/html-event.git","ssh_url":"git@github.com:Nemo157/html-event.git","clone_url":"https://github.com/Nemo157/html-event.git","svn_url":"https://github.com/Nemo157/html-event","homepage":null,"size":17,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Nemo157/html-event/pulls/2"},"html":{"href":"https://github.com/Nemo157/html-event/pull/2"},"issue":{"href":"https://api.github.com/repos/Nemo157/html-event/issues/2"},"comments":{"href":"https://api.github.com/repos/Nemo157/html-event/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/Nemo157/html-event/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/Nemo157/html-event/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Nemo157/html-event/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/Nemo157/html-event/statuses/d42cba555f4e7c35c821dfe935fe287576cf4a59"}}}}