{"action":"closed","number":424,"pull_request":{"url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/424","id":37659281,"html_url":"https://github.com/AngryLawyer/rust-sdl2/pull/424","diff_url":"https://github.com/AngryLawyer/rust-sdl2/pull/424.diff","patch_url":"https://github.com/AngryLawyer/rust-sdl2/pull/424.patch","issue_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/424","number":424,"state":"closed","locked":false,"title":"Keyboard state iterator, move Scancode and Keycode enums","user":{"login":"nukep","id":1551458,"avatar_url":"https://avatars.githubusercontent.com/u/1551458?v=3","gravatar_id":"","url":"https://api.github.com/users/nukep","html_url":"https://github.com/nukep","followers_url":"https://api.github.com/users/nukep/followers","following_url":"https://api.github.com/users/nukep/following{/other_user}","gists_url":"https://api.github.com/users/nukep/gists{/gist_id}","starred_url":"https://api.github.com/users/nukep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nukep/subscriptions","organizations_url":"https://api.github.com/users/nukep/orgs","repos_url":"https://api.github.com/users/nukep/repos","events_url":"https://api.github.com/users/nukep/events{/privacy}","received_events_url":"https://api.github.com/users/nukep/received_events","type":"User","site_admin":false},"body":"`keyboard::get_keyboard_state()` would always create and return a `HashMap<(ScanCode, bool)>`.\r\nThis is replaced with an iterator that never needs to allocate new data collections.\r\n```rust\r\n// 1. Iterate all pressed scancodes\r\nfor scancode in sdl_context.keyboard_state().pressed_scancodes() {\r\n    // ...\r\n}\r\n\r\n// or 2. Collect into a set or a collection of your choice (such as Vec, BTreeSet, etc.)\r\nlet pressed: HashSet<Scancode> = sdl_context.keyboard_state().pressed_scancodes().collect();\r\n```\r\n\r\nIn games, it can be useful to determine a set of newly pressed or released keys. If you use a set collection, it's easy to do this with the [`HashSet::difference()`](http://doc.rust-lang.org/stable/std/collections/struct.HashSet.html#method.difference) method or `Sub` operator. There's an example that does this at examples/keyboard-state.rs.\r\n\r\nThroughout the library, I'd like to replace all \"non-value\" enum variants (the \"Nones\", \"Invalids\", etc.) with `Option::None`.\r\nConstants such as `SDLK_UNKNOWN` exist to communicate errors to the caller, yet they aren't polymorphic to the other variants; `Keycode::Unknown` must be ignored or treated differently from the other keys because it doesn't indicate a \"real\" key. This is basically a rewording of the \"null\" problem.","created_at":"2015-06-15T05:25:03Z","updated_at":"2015-06-16T10:29:30Z","closed_at":"2015-06-16T10:29:30Z","merged_at":"2015-06-16T10:29:30Z","merge_commit_sha":"684bb2e2dc11451ec5bdef24c84448fc29ebea53","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/424/commits","review_comments_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/424/comments","review_comment_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/424/comments","statuses_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/statuses/2af5dcfac43e31cc641d2b8bb05f975ef461262c","head":{"label":"nukep:keyboard","ref":"keyboard","sha":"2af5dcfac43e31cc641d2b8bb05f975ef461262c","user":{"login":"nukep","id":1551458,"avatar_url":"https://avatars.githubusercontent.com/u/1551458?v=3","gravatar_id":"","url":"https://api.github.com/users/nukep","html_url":"https://github.com/nukep","followers_url":"https://api.github.com/users/nukep/followers","following_url":"https://api.github.com/users/nukep/following{/other_user}","gists_url":"https://api.github.com/users/nukep/gists{/gist_id}","starred_url":"https://api.github.com/users/nukep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nukep/subscriptions","organizations_url":"https://api.github.com/users/nukep/orgs","repos_url":"https://api.github.com/users/nukep/repos","events_url":"https://api.github.com/users/nukep/events{/privacy}","received_events_url":"https://api.github.com/users/nukep/received_events","type":"User","site_admin":false},"repo":{"id":27097459,"name":"rust-sdl2","full_name":"nukep/rust-sdl2","owner":{"login":"nukep","id":1551458,"avatar_url":"https://avatars.githubusercontent.com/u/1551458?v=3","gravatar_id":"","url":"https://api.github.com/users/nukep","html_url":"https://github.com/nukep","followers_url":"https://api.github.com/users/nukep/followers","following_url":"https://api.github.com/users/nukep/following{/other_user}","gists_url":"https://api.github.com/users/nukep/gists{/gist_id}","starred_url":"https://api.github.com/users/nukep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nukep/subscriptions","organizations_url":"https://api.github.com/users/nukep/orgs","repos_url":"https://api.github.com/users/nukep/repos","events_url":"https://api.github.com/users/nukep/events{/privacy}","received_events_url":"https://api.github.com/users/nukep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nukep/rust-sdl2","description":"SDL2 bindings for Rust","fork":true,"url":"https://api.github.com/repos/nukep/rust-sdl2","forks_url":"https://api.github.com/repos/nukep/rust-sdl2/forks","keys_url":"https://api.github.com/repos/nukep/rust-sdl2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nukep/rust-sdl2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nukep/rust-sdl2/teams","hooks_url":"https://api.github.com/repos/nukep/rust-sdl2/hooks","issue_events_url":"https://api.github.com/repos/nukep/rust-sdl2/issues/events{/number}","events_url":"https://api.github.com/repos/nukep/rust-sdl2/events","assignees_url":"https://api.github.com/repos/nukep/rust-sdl2/assignees{/user}","branches_url":"https://api.github.com/repos/nukep/rust-sdl2/branches{/branch}","tags_url":"https://api.github.com/repos/nukep/rust-sdl2/tags","blobs_url":"https://api.github.com/repos/nukep/rust-sdl2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nukep/rust-sdl2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nukep/rust-sdl2/git/refs{/sha}","trees_url":"https://api.github.com/repos/nukep/rust-sdl2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nukep/rust-sdl2/statuses/{sha}","languages_url":"https://api.github.com/repos/nukep/rust-sdl2/languages","stargazers_url":"https://api.github.com/repos/nukep/rust-sdl2/stargazers","contributors_url":"https://api.github.com/repos/nukep/rust-sdl2/contributors","subscribers_url":"https://api.github.com/repos/nukep/rust-sdl2/subscribers","subscription_url":"https://api.github.com/repos/nukep/rust-sdl2/subscription","commits_url":"https://api.github.com/repos/nukep/rust-sdl2/commits{/sha}","git_commits_url":"https://api.github.com/repos/nukep/rust-sdl2/git/commits{/sha}","comments_url":"https://api.github.com/repos/nukep/rust-sdl2/comments{/number}","issue_comment_url":"https://api.github.com/repos/nukep/rust-sdl2/issues/comments{/number}","contents_url":"https://api.github.com/repos/nukep/rust-sdl2/contents/{+path}","compare_url":"https://api.github.com/repos/nukep/rust-sdl2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nukep/rust-sdl2/merges","archive_url":"https://api.github.com/repos/nukep/rust-sdl2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nukep/rust-sdl2/downloads","issues_url":"https://api.github.com/repos/nukep/rust-sdl2/issues{/number}","pulls_url":"https://api.github.com/repos/nukep/rust-sdl2/pulls{/number}","milestones_url":"https://api.github.com/repos/nukep/rust-sdl2/milestones{/number}","notifications_url":"https://api.github.com/repos/nukep/rust-sdl2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nukep/rust-sdl2/labels{/name}","releases_url":"https://api.github.com/repos/nukep/rust-sdl2/releases{/id}","created_at":"2014-11-24T22:10:18Z","updated_at":"2015-04-14T04:19:10Z","pushed_at":"2015-06-15T04:15:04Z","git_url":"git://github.com/nukep/rust-sdl2.git","ssh_url":"git@github.com:nukep/rust-sdl2.git","clone_url":"https://github.com/nukep/rust-sdl2.git","svn_url":"https://github.com/nukep/rust-sdl2","homepage":null,"size":2785,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AngryLawyer:master","ref":"master","sha":"1aec5f7b4fdf530e5c8a7792c8d37211ec20b9b1","user":{"login":"AngryLawyer","id":1378607,"avatar_url":"https://avatars.githubusercontent.com/u/1378607?v=3","gravatar_id":"","url":"https://api.github.com/users/AngryLawyer","html_url":"https://github.com/AngryLawyer","followers_url":"https://api.github.com/users/AngryLawyer/followers","following_url":"https://api.github.com/users/AngryLawyer/following{/other_user}","gists_url":"https://api.github.com/users/AngryLawyer/gists{/gist_id}","starred_url":"https://api.github.com/users/AngryLawyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngryLawyer/subscriptions","organizations_url":"https://api.github.com/users/AngryLawyer/orgs","repos_url":"https://api.github.com/users/AngryLawyer/repos","events_url":"https://api.github.com/users/AngryLawyer/events{/privacy}","received_events_url":"https://api.github.com/users/AngryLawyer/received_events","type":"User","site_admin":false},"repo":{"id":12176600,"name":"rust-sdl2","full_name":"AngryLawyer/rust-sdl2","owner":{"login":"AngryLawyer","id":1378607,"avatar_url":"https://avatars.githubusercontent.com/u/1378607?v=3","gravatar_id":"","url":"https://api.github.com/users/AngryLawyer","html_url":"https://github.com/AngryLawyer","followers_url":"https://api.github.com/users/AngryLawyer/followers","following_url":"https://api.github.com/users/AngryLawyer/following{/other_user}","gists_url":"https://api.github.com/users/AngryLawyer/gists{/gist_id}","starred_url":"https://api.github.com/users/AngryLawyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngryLawyer/subscriptions","organizations_url":"https://api.github.com/users/AngryLawyer/orgs","repos_url":"https://api.github.com/users/AngryLawyer/repos","events_url":"https://api.github.com/users/AngryLawyer/events{/privacy}","received_events_url":"https://api.github.com/users/AngryLawyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AngryLawyer/rust-sdl2","description":"SDL2 bindings for Rust","fork":false,"url":"https://api.github.com/repos/AngryLawyer/rust-sdl2","forks_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/forks","keys_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/teams","hooks_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/hooks","issue_events_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/events{/number}","events_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/events","assignees_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/assignees{/user}","branches_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/branches{/branch}","tags_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/tags","blobs_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/git/refs{/sha}","trees_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/statuses/{sha}","languages_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/languages","stargazers_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/stargazers","contributors_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/contributors","subscribers_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/subscribers","subscription_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/subscription","commits_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/commits{/sha}","git_commits_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/git/commits{/sha}","comments_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/comments{/number}","issue_comment_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/comments{/number}","contents_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/contents/{+path}","compare_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/merges","archive_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/downloads","issues_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues{/number}","pulls_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls{/number}","milestones_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/milestones{/number}","notifications_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/labels{/name}","releases_url":"https://api.github.com/repos/AngryLawyer/rust-sdl2/releases{/id}","created_at":"2013-08-17T09:27:54Z","updated_at":"2015-06-14T12:49:23Z","pushed_at":"2015-06-16T10:29:30Z","git_url":"git://github.com/AngryLawyer/rust-sdl2.git","ssh_url":"git@github.com:AngryLawyer/rust-sdl2.git","clone_url":"https://github.com/AngryLawyer/rust-sdl2.git","svn_url":"https://github.com/AngryLawyer/rust-sdl2","homepage":null,"size":3033,"stargazers_count":246,"watchers_count":246,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":113,"mirror_url":null,"open_issues_count":18,"forks":113,"open_issues":18,"watchers":246,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/424"},"html":{"href":"https://github.com/AngryLawyer/rust-sdl2/pull/424"},"issue":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/424"},"comments":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/issues/424/comments"},"review_comments":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/424/comments"},"review_comment":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/pulls/424/commits"},"statuses":{"href":"https://api.github.com/repos/AngryLawyer/rust-sdl2/statuses/2af5dcfac43e31cc641d2b8bb05f975ef461262c"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"AngryLawyer","id":1378607,"avatar_url":"https://avatars.githubusercontent.com/u/1378607?v=3","gravatar_id":"","url":"https://api.github.com/users/AngryLawyer","html_url":"https://github.com/AngryLawyer","followers_url":"https://api.github.com/users/AngryLawyer/followers","following_url":"https://api.github.com/users/AngryLawyer/following{/other_user}","gists_url":"https://api.github.com/users/AngryLawyer/gists{/gist_id}","starred_url":"https://api.github.com/users/AngryLawyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngryLawyer/subscriptions","organizations_url":"https://api.github.com/users/AngryLawyer/orgs","repos_url":"https://api.github.com/users/AngryLawyer/repos","events_url":"https://api.github.com/users/AngryLawyer/events{/privacy}","received_events_url":"https://api.github.com/users/AngryLawyer/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":4,"additions":354,"deletions":178,"changed_files":12}}