{"action":"created","issue":{"url":"https://api.github.com/repos/sfackler/rust-postgres-array/issues/7","repository_url":"https://api.github.com/repos/sfackler/rust-postgres-array","labels_url":"https://api.github.com/repos/sfackler/rust-postgres-array/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/sfackler/rust-postgres-array/issues/7/comments","events_url":"https://api.github.com/repos/sfackler/rust-postgres-array/issues/7/events","html_url":"https://github.com/sfackler/rust-postgres-array/pull/7","id":149282849,"number":7,"title":"Add .extract() for extracting underlying Vec","user":{"login":"jonhoo","id":176295,"avatar_url":"https://avatars.githubusercontent.com/u/176295?v=3","gravatar_id":"","url":"https://api.github.com/users/jonhoo","html_url":"https://github.com/jonhoo","followers_url":"https://api.github.com/users/jonhoo/followers","following_url":"https://api.github.com/users/jonhoo/following{/other_user}","gists_url":"https://api.github.com/users/jonhoo/gists{/gist_id}","starred_url":"https://api.github.com/users/jonhoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonhoo/subscriptions","organizations_url":"https://api.github.com/users/jonhoo/orgs","repos_url":"https://api.github.com/users/jonhoo/repos","events_url":"https://api.github.com/users/jonhoo/events{/privacy}","received_events_url":"https://api.github.com/users/jonhoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-18T21:55:20Z","updated_at":"2016-04-19T02:03:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sfackler/rust-postgres-array/pulls/7","html_url":"https://github.com/sfackler/rust-postgres-array/pull/7","diff_url":"https://github.com/sfackler/rust-postgres-array/pull/7.diff","patch_url":"https://github.com/sfackler/rust-postgres-array/pull/7.patch"},"body":"When fetching rows with `rust-postgres`, turning a Postgres Array from a returned row into a Rust Vec is not quite straightforward, and requirings going to an `IntoIterator` and back:\r\n```rust\r\nrow.get::<_, Array<_>>(0).into_iter().collect()\r\n```\r\nThis adds overhead, and could even add an allocation in the worst case. A better solution would be to provide a method for directly extracting the underlying Vec of a row.\r\n\r\nThis PR adds `Array::extract()`, which does just that. It consumes the `Array`, and returns the underlying `Vec`, allowing the code above to be expressed as:\r\n```rust\r\nrow.get::<_, Array<_>>(0).extract()\r\n```"},"comment":{"url":"https://api.github.com/repos/sfackler/rust-postgres-array/issues/comments/211686592","html_url":"https://github.com/sfackler/rust-postgres-array/pull/7#issuecomment-211686592","issue_url":"https://api.github.com/repos/sfackler/rust-postgres-array/issues/7","id":211686592,"user":{"login":"sfackler","id":1455697,"avatar_url":"https://avatars.githubusercontent.com/u/1455697?v=3","gravatar_id":"","url":"https://api.github.com/users/sfackler","html_url":"https://github.com/sfackler","followers_url":"https://api.github.com/users/sfackler/followers","following_url":"https://api.github.com/users/sfackler/following{/other_user}","gists_url":"https://api.github.com/users/sfackler/gists{/gist_id}","starred_url":"https://api.github.com/users/sfackler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfackler/subscriptions","organizations_url":"https://api.github.com/users/sfackler/orgs","repos_url":"https://api.github.com/users/sfackler/repos","events_url":"https://api.github.com/users/sfackler/events{/privacy}","received_events_url":"https://api.github.com/users/sfackler/received_events","type":"User","site_admin":false},"created_at":"2016-04-19T02:03:26Z","updated_at":"2016-04-19T02:03:26Z","body":"That's because I forgot to mention it in the table in the readme, will fix :). It is mentioned in the docs for FromSql and ToSql though: http://sfackler.github.io/rust-postgres/doc/v0.11.7/postgres/types/trait.FromSql.html#arrays."}}