{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/comments/28601547","id":28601547,"diff_hunk":"@@ -0,0 +1,673 @@\n+---\n+layout: post\n+title: \"Mixing matching, mutation, and moves in Rust\"\n+author: Felix S. Klock II\n+description: \"A tour of matching and enums in Rust.\"\n+---\n+\n+One of the primary goals of the Rust project is to enable safe systems\n+programming. Systems programming usually implies imperative\n+programming, which in turns often implies side-effects, reasoning\n+about shared, aliasable state, et cetera.\n+\n+At the same time, to provide *safety*, Rust programs and data types\n+must be structured in a way that allows static checking to ensure\n+soundness. Rust has features and restrictions that operate in tandem\n+to ease writing programs that can pass these checks and thus ensure\n+safety. For example, Rust incorporates the notion of *ownership* deeply\n+into the language.\n+\n+Rust's `match` expression is a construct that offers an interesting\n+combination of such features and restrictions. A `match` expression\n+takes an input value, classifies it, and then jumps to code written to\n+handle the identified class of data.\n+\n+In this post we explore how Rust processes such data via `match`.\n+The crucial elements that `match` and its counterpart `enum` tie\n+together are:\n+\n+* Structural pattern matching of algebraic data types: The `match`","path":"_posts/2015-04-17-Enums-match-mutation-and-moves.md","position":29,"original_position":29,"commit_id":"e6200ab9a1f6c957d0f7a49edfeb4d77eaea46f6","original_commit_id":"e6200ab9a1f6c957d0f7a49edfeb4d77eaea46f6","user":{"login":"pnkfelix","id":173127,"avatar_url":"https://avatars.githubusercontent.com/u/173127?v=3","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"body":"(todo: drop \"of algebraic data types\")","created_at":"2015-04-17T15:01:48Z","updated_at":"2015-04-17T15:01:48Z","html_url":"https://github.com/rust-lang/blog.rust-lang.org/pull/38#discussion_r28601547","pull_request_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/comments/28601547"},"html":{"href":"https://github.com/rust-lang/blog.rust-lang.org/pull/38#discussion_r28601547"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38","id":32947653,"html_url":"https://github.com/rust-lang/blog.rust-lang.org/pull/38","diff_url":"https://github.com/rust-lang/blog.rust-lang.org/pull/38.diff","patch_url":"https://github.com/rust-lang/blog.rust-lang.org/pull/38.patch","issue_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues/38","number":38,"state":"open","locked":false,"title":"second draft of enums post.","user":{"login":"pnkfelix","id":173127,"avatar_url":"https://avatars.githubusercontent.com/u/173127?v=3","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"body":"cc @nikomatsakis @aturon \r\n\r\n[rendered](https://github.com/pnkfelix/blog.rust-lang.org/blob/fsk-enums-post/_posts/2015-04-17-Enums-match-mutation-and-moves.md)","created_at":"2015-04-09T11:39:01Z","updated_at":"2015-04-17T15:01:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18876afdd9378aa2c7f5f7d9b04b750a14a19675","assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38/commits","review_comments_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38/comments","review_comment_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues/38/comments","statuses_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/statuses/e6200ab9a1f6c957d0f7a49edfeb4d77eaea46f6","head":{"label":"pnkfelix:fsk-enums-post","ref":"fsk-enums-post","sha":"e6200ab9a1f6c957d0f7a49edfeb4d77eaea46f6","user":{"login":"pnkfelix","id":173127,"avatar_url":"https://avatars.githubusercontent.com/u/173127?v=3","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"repo":{"id":33618325,"name":"blog.rust-lang.org","full_name":"pnkfelix/blog.rust-lang.org","owner":{"login":"pnkfelix","id":173127,"avatar_url":"https://avatars.githubusercontent.com/u/173127?v=3","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pnkfelix/blog.rust-lang.org","description":"","fork":true,"url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org","forks_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/forks","keys_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/teams","hooks_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/hooks","issue_events_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/issues/events{/number}","events_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/events","assignees_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/assignees{/user}","branches_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/branches{/branch}","tags_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/tags","blobs_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/statuses/{sha}","languages_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/languages","stargazers_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/stargazers","contributors_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/contributors","subscribers_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/subscribers","subscription_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/subscription","commits_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/contents/{+path}","compare_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/merges","archive_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/downloads","issues_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/issues{/number}","pulls_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/pulls{/number}","milestones_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/milestones{/number}","notifications_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/labels{/name}","releases_url":"https://api.github.com/repos/pnkfelix/blog.rust-lang.org/releases{/id}","created_at":"2015-04-08T16:23:56Z","updated_at":"2015-04-08T16:23:56Z","pushed_at":"2015-04-17T14:51:27Z","git_url":"git://github.com/pnkfelix/blog.rust-lang.org.git","ssh_url":"git@github.com:pnkfelix/blog.rust-lang.org.git","clone_url":"https://github.com/pnkfelix/blog.rust-lang.org.git","svn_url":"https://github.com/pnkfelix/blog.rust-lang.org","homepage":"http://blog.rust-lang.org","size":186,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"rust-lang:gh-pages","ref":"gh-pages","sha":"7fda9199d11afdbaad4f6331aa6c359e407babdc","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":23805312,"name":"blog.rust-lang.org","full_name":"rust-lang/blog.rust-lang.org","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/blog.rust-lang.org","description":"","fork":false,"url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org","forks_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/forks","keys_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/teams","hooks_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/events","assignees_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/tags","blobs_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/languages","stargazers_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/subscription","commits_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/merges","archive_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/downloads","issues_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/releases{/id}","created_at":"2014-09-08T19:38:05Z","updated_at":"2015-04-16T14:33:15Z","pushed_at":"2015-04-17T14:51:28Z","git_url":"git://github.com/rust-lang/blog.rust-lang.org.git","ssh_url":"git@github.com:rust-lang/blog.rust-lang.org.git","clone_url":"https://github.com/rust-lang/blog.rust-lang.org.git","svn_url":"https://github.com/rust-lang/blog.rust-lang.org","homepage":"http://blog.rust-lang.org","size":895,"stargazers_count":5,"watchers_count":5,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":1,"forks":18,"open_issues":1,"watchers":5,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38"},"html":{"href":"https://github.com/rust-lang/blog.rust-lang.org/pull/38"},"issue":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues/38"},"comments":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/blog.rust-lang.org/statuses/e6200ab9a1f6c957d0f7a49edfeb4d77eaea46f6"}}}}