{"action":"created","comment":{"url":"https://api.github.com/repos/servo/rust-url/pulls/comments/92948190","pull_request_review_id":13470034,"id":92948190,"diff_hunk":"@@ -1502,10 +1510,61 @@ impl rustc_serialize::Decodable for Url {\n     }\n }\n \n+#[cfg(feature=\"serde\")]\n+impl Url {\n+    /// Serialize the URL efficiently, for use with IPC\n+    pub fn serialize_efficient<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: serde::Serializer {\n+        use serde::Serialize;\n+        // Destructuring first lets us ensure that adding or removing fields forces this method\n+        // to be updated\n+        let Url { ref serialization, ref scheme_end,\n+                  ref username_end, ref host_start,\n+                  ref host_end, ref host, ref port,\n+                  ref path_start, ref query_start,\n+                  ref fragment_start} = *self;\n+        (serialization, scheme_end, username_end,\n+         host_start, host_end, host, port, path_start,\n+         query_start, fragment_start).serialize(serializer)\n+    }\n+\n+    /// Deserialize the URL efficiently, without re-parsing\n+    ///\n+    /// Deserializer must be known to contain the output of serialize_efficient\n+    ///\n+    /// Cannot cause memory unsafety if used incorrectly, but may cause security issues.\n+    /// Only use with trusted input.\n+    pub fn deserialize_efficient<D>(deserializer: &mut D)\n+        -> Result<Url, D::Error>\n+        where D: serde::Deserializer {\n+        use serde::{Deserialize, Error};\n+        let (serialization, scheme_end, username_end,\n+         host_start, host_end, host, port, path_start,\n+         query_start, fragment_start) = Deserialize::deserialize(deserializer)?;\n+        let url = Url {\n+            serialization: serialization,\n+            scheme_end: scheme_end,\n+            username_end: username_end,\n+            host_start: host_start,\n+            host_end: host_end,\n+            host: host,\n+            port: port,\n+            path_start: path_start,\n+            query_start: query_start,\n+            fragment_start: fragment_start\n+        };\n+        #[cfg(debug_assertions)] {","path":"src/lib.rs","position":92,"original_position":92,"commit_id":"1c00b566133a397f74f6bfacc8f2e06f178dedec","original_commit_id":"1c00b566133a397f74f6bfacc8f2e06f178dedec","user":{"login":"nox","id":123095,"avatar_url":"https://avatars.githubusercontent.com/u/123095?v=3","gravatar_id":"","url":"https://api.github.com/users/nox","html_url":"https://github.com/nox","followers_url":"https://api.github.com/users/nox/followers","following_url":"https://api.github.com/users/nox/following{/other_user}","gists_url":"https://api.github.com/users/nox/gists{/gist_id}","starred_url":"https://api.github.com/users/nox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nox/subscriptions","organizations_url":"https://api.github.com/users/nox/orgs","repos_url":"https://api.github.com/users/nox/repos","events_url":"https://api.github.com/users/nox/events{/privacy}","received_events_url":"https://api.github.com/users/nox/received_events","type":"User","site_admin":false},"body":"Without `debug_assertions`, type errors in that block won't be emitted.  Do `if cfg!(debug_assertions)` instead.","created_at":"2016-12-18T19:01:04Z","updated_at":"2016-12-18T19:01:04Z","html_url":"https://github.com/servo/rust-url/pull/252#discussion_r92948190","pull_request_url":"https://api.github.com/repos/servo/rust-url/pulls/252","_links":{"self":{"href":"https://api.github.com/repos/servo/rust-url/pulls/comments/92948190"},"html":{"href":"https://github.com/servo/rust-url/pull/252#discussion_r92948190"},"pull_request":{"href":"https://api.github.com/repos/servo/rust-url/pulls/252"}}},"pull_request":{"url":"https://api.github.com/repos/servo/rust-url/pulls/252","id":98455913,"html_url":"https://github.com/servo/rust-url/pull/252","diff_url":"https://github.com/servo/rust-url/pull/252.diff","patch_url":"https://github.com/servo/rust-url/pull/252.patch","issue_url":"https://api.github.com/repos/servo/rust-url/issues/252","number":252,"state":"open","locked":false,"title":"Add faster serde serialization, sacrificing invariant-safety for speed in release mode; test that it roudtrips","user":{"login":"Manishearth","id":1617736,"avatar_url":"https://avatars.githubusercontent.com/u/1617736?v=3","gravatar_id":"","url":"https://api.github.com/users/Manishearth","html_url":"https://github.com/Manishearth","followers_url":"https://api.github.com/users/Manishearth/followers","following_url":"https://api.github.com/users/Manishearth/following{/other_user}","gists_url":"https://api.github.com/users/Manishearth/gists{/gist_id}","starred_url":"https://api.github.com/users/Manishearth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Manishearth/subscriptions","organizations_url":"https://api.github.com/users/Manishearth/orgs","repos_url":"https://api.github.com/users/Manishearth/repos","events_url":"https://api.github.com/users/Manishearth/events{/privacy}","received_events_url":"https://api.github.com/users/Manishearth/received_events","type":"User","site_admin":false},"body":"r? @SimonSapin\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/servo/rust-url/252)\n<!-- Reviewable:end -->\n","created_at":"2016-12-17T21:08:18Z","updated_at":"2016-12-18T19:01:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4fe8afb942707347fb0909615832cc86a8e21dfa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/servo/rust-url/pulls/252/commits","review_comments_url":"https://api.github.com/repos/servo/rust-url/pulls/252/comments","review_comment_url":"https://api.github.com/repos/servo/rust-url/pulls/comments{/number}","comments_url":"https://api.github.com/repos/servo/rust-url/issues/252/comments","statuses_url":"https://api.github.com/repos/servo/rust-url/statuses/1c00b566133a397f74f6bfacc8f2e06f178dedec","head":{"label":"servo:serde","ref":"serde","sha":"1c00b566133a397f74f6bfacc8f2e06f178dedec","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"repo":{"id":14934771,"name":"rust-url","full_name":"servo/rust-url","owner":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/servo/rust-url","description":"URL parser for Rust","fork":false,"url":"https://api.github.com/repos/servo/rust-url","forks_url":"https://api.github.com/repos/servo/rust-url/forks","keys_url":"https://api.github.com/repos/servo/rust-url/keys{/key_id}","collaborators_url":"https://api.github.com/repos/servo/rust-url/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/servo/rust-url/teams","hooks_url":"https://api.github.com/repos/servo/rust-url/hooks","issue_events_url":"https://api.github.com/repos/servo/rust-url/issues/events{/number}","events_url":"https://api.github.com/repos/servo/rust-url/events","assignees_url":"https://api.github.com/repos/servo/rust-url/assignees{/user}","branches_url":"https://api.github.com/repos/servo/rust-url/branches{/branch}","tags_url":"https://api.github.com/repos/servo/rust-url/tags","blobs_url":"https://api.github.com/repos/servo/rust-url/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/servo/rust-url/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/servo/rust-url/git/refs{/sha}","trees_url":"https://api.github.com/repos/servo/rust-url/git/trees{/sha}","statuses_url":"https://api.github.com/repos/servo/rust-url/statuses/{sha}","languages_url":"https://api.github.com/repos/servo/rust-url/languages","stargazers_url":"https://api.github.com/repos/servo/rust-url/stargazers","contributors_url":"https://api.github.com/repos/servo/rust-url/contributors","subscribers_url":"https://api.github.com/repos/servo/rust-url/subscribers","subscription_url":"https://api.github.com/repos/servo/rust-url/subscription","commits_url":"https://api.github.com/repos/servo/rust-url/commits{/sha}","git_commits_url":"https://api.github.com/repos/servo/rust-url/git/commits{/sha}","comments_url":"https://api.github.com/repos/servo/rust-url/comments{/number}","issue_comment_url":"https://api.github.com/repos/servo/rust-url/issues/comments{/number}","contents_url":"https://api.github.com/repos/servo/rust-url/contents/{+path}","compare_url":"https://api.github.com/repos/servo/rust-url/compare/{base}...{head}","merges_url":"https://api.github.com/repos/servo/rust-url/merges","archive_url":"https://api.github.com/repos/servo/rust-url/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/servo/rust-url/downloads","issues_url":"https://api.github.com/repos/servo/rust-url/issues{/number}","pulls_url":"https://api.github.com/repos/servo/rust-url/pulls{/number}","milestones_url":"https://api.github.com/repos/servo/rust-url/milestones{/number}","notifications_url":"https://api.github.com/repos/servo/rust-url/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/servo/rust-url/labels{/name}","releases_url":"https://api.github.com/repos/servo/rust-url/releases{/id}","deployments_url":"https://api.github.com/repos/servo/rust-url/deployments","created_at":"2013-12-04T20:19:38Z","updated_at":"2016-12-17T23:30:53Z","pushed_at":"2016-12-18T08:36:05Z","git_url":"git://github.com/servo/rust-url.git","ssh_url":"git@github.com:servo/rust-url.git","clone_url":"https://github.com/servo/rust-url.git","svn_url":"https://github.com/servo/rust-url","homepage":"http://servo.github.io/rust-url/url/index.html","size":1652,"stargazers_count":187,"watchers_count":187,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":82,"mirror_url":null,"open_issues_count":19,"forks":82,"open_issues":19,"watchers":187,"default_branch":"master"}},"base":{"label":"servo:master","ref":"master","sha":"a00fc9041870b34aa8ed5f41a3295d6cf2b4c7b7","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"repo":{"id":14934771,"name":"rust-url","full_name":"servo/rust-url","owner":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/servo/rust-url","description":"URL parser for Rust","fork":false,"url":"https://api.github.com/repos/servo/rust-url","forks_url":"https://api.github.com/repos/servo/rust-url/forks","keys_url":"https://api.github.com/repos/servo/rust-url/keys{/key_id}","collaborators_url":"https://api.github.com/repos/servo/rust-url/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/servo/rust-url/teams","hooks_url":"https://api.github.com/repos/servo/rust-url/hooks","issue_events_url":"https://api.github.com/repos/servo/rust-url/issues/events{/number}","events_url":"https://api.github.com/repos/servo/rust-url/events","assignees_url":"https://api.github.com/repos/servo/rust-url/assignees{/user}","branches_url":"https://api.github.com/repos/servo/rust-url/branches{/branch}","tags_url":"https://api.github.com/repos/servo/rust-url/tags","blobs_url":"https://api.github.com/repos/servo/rust-url/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/servo/rust-url/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/servo/rust-url/git/refs{/sha}","trees_url":"https://api.github.com/repos/servo/rust-url/git/trees{/sha}","statuses_url":"https://api.github.com/repos/servo/rust-url/statuses/{sha}","languages_url":"https://api.github.com/repos/servo/rust-url/languages","stargazers_url":"https://api.github.com/repos/servo/rust-url/stargazers","contributors_url":"https://api.github.com/repos/servo/rust-url/contributors","subscribers_url":"https://api.github.com/repos/servo/rust-url/subscribers","subscription_url":"https://api.github.com/repos/servo/rust-url/subscription","commits_url":"https://api.github.com/repos/servo/rust-url/commits{/sha}","git_commits_url":"https://api.github.com/repos/servo/rust-url/git/commits{/sha}","comments_url":"https://api.github.com/repos/servo/rust-url/comments{/number}","issue_comment_url":"https://api.github.com/repos/servo/rust-url/issues/comments{/number}","contents_url":"https://api.github.com/repos/servo/rust-url/contents/{+path}","compare_url":"https://api.github.com/repos/servo/rust-url/compare/{base}...{head}","merges_url":"https://api.github.com/repos/servo/rust-url/merges","archive_url":"https://api.github.com/repos/servo/rust-url/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/servo/rust-url/downloads","issues_url":"https://api.github.com/repos/servo/rust-url/issues{/number}","pulls_url":"https://api.github.com/repos/servo/rust-url/pulls{/number}","milestones_url":"https://api.github.com/repos/servo/rust-url/milestones{/number}","notifications_url":"https://api.github.com/repos/servo/rust-url/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/servo/rust-url/labels{/name}","releases_url":"https://api.github.com/repos/servo/rust-url/releases{/id}","deployments_url":"https://api.github.com/repos/servo/rust-url/deployments","created_at":"2013-12-04T20:19:38Z","updated_at":"2016-12-17T23:30:53Z","pushed_at":"2016-12-18T08:36:05Z","git_url":"git://github.com/servo/rust-url.git","ssh_url":"git@github.com:servo/rust-url.git","clone_url":"https://github.com/servo/rust-url.git","svn_url":"https://github.com/servo/rust-url","homepage":"http://servo.github.io/rust-url/url/index.html","size":1652,"stargazers_count":187,"watchers_count":187,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":82,"mirror_url":null,"open_issues_count":19,"forks":82,"open_issues":19,"watchers":187,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/servo/rust-url/pulls/252"},"html":{"href":"https://github.com/servo/rust-url/pull/252"},"issue":{"href":"https://api.github.com/repos/servo/rust-url/issues/252"},"comments":{"href":"https://api.github.com/repos/servo/rust-url/issues/252/comments"},"review_comments":{"href":"https://api.github.com/repos/servo/rust-url/pulls/252/comments"},"review_comment":{"href":"https://api.github.com/repos/servo/rust-url/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/servo/rust-url/pulls/252/commits"},"statuses":{"href":"https://api.github.com/repos/servo/rust-url/statuses/1c00b566133a397f74f6bfacc8f2e06f178dedec"}}}}
{"actor":{"display_login":"nox"}}