{"action":"opened","number":192,"pull_request":{"url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/192","id":58238187,"html_url":"https://github.com/Reactive-Extensions/RxCpp/pull/192","diff_url":"https://github.com/Reactive-Extensions/RxCpp/pull/192.diff","patch_url":"https://github.com/Reactive-Extensions/RxCpp/pull/192.patch","issue_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues/192","number":192,"state":"open","locked":false,"title":"add async-subject","user":{"login":"schiebel","id":8408745,"avatar_url":"https://avatars.githubusercontent.com/u/8408745?v=3","gravatar_id":"","url":"https://api.github.com/users/schiebel","html_url":"https://github.com/schiebel","followers_url":"https://api.github.com/users/schiebel/followers","following_url":"https://api.github.com/users/schiebel/following{/other_user}","gists_url":"https://api.github.com/users/schiebel/gists{/gist_id}","starred_url":"https://api.github.com/users/schiebel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schiebel/subscriptions","organizations_url":"https://api.github.com/users/schiebel/orgs","repos_url":"https://api.github.com/users/schiebel/repos","events_url":"https://api.github.com/users/schiebel/events{/privacy}","received_events_url":"https://api.github.com/users/schiebel/received_events","type":"User","site_admin":false},"body":"I intended to open an issue instead of a pull request, but I could not find a way to include diffs in an issue request. This pull request includes my changes to add async_subject to RxCpp. I used it to create to_async(f) as shown below. Please let me know if you have any suggested changes or improvements or (of course) bugs!\r\n\r\n    namespace details {\r\n        template<class F, class R, class... A>\r\n        struct to_async_functor {\r\n            F f;\r\n            to_async_functor( F f_ ) : f(move(f_)) { }\r\n            rxcpp::subjects::async_subject<R> result(A... a);\r\n            rxcpp::observable<R> operator( )(const A&... a) {\r\n                auto result = rxcpp::subjects::async_subject<R>( );\r\n                rxcpp::observe_on_new_thread().create_coordinator().get_worker().schedule(\r\n                    [=](const rxcpp::rxsc::schedulable&) {\r\n                        rxcpp::util::maybe<R> value;\r\n                        try {\r\n                            value = f(a...);\r\n                            result.get_subscriber( ).on_next(value.get( ));\r\n                            result.get_subscriber( ).on_completed( );\r\n                        } catch (...) {\r\n                            result.get_subscriber( ).on_error(std::current_exception());\r\n                        }\r\n                    } );\r\n                return result.get_observable( );\r\n            }\r\n        };\r\n    }\r\n    \r\n    template<class... A, class F>\r\n    auto to_async( F f )\r\n        -> details::to_async_functor<F,decltype(f((*(A*) nullptr)...)),A...>\r\n    {\r\n        typedef decltype(f((*(A*) nullptr)...)) R;\r\n        return details::to_async_functor<F,R,A...>(f);\r\n    }\r\n","created_at":"2016-02-04T03:50:18Z","updated_at":"2016-02-04T03:50:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/192/commits","review_comments_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/192/comments","review_comment_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues/192/comments","statuses_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/statuses/1bcbe91e760800c14b280b5bd6d9c640c9012b78","head":{"label":"schiebel:master","ref":"master","sha":"1bcbe91e760800c14b280b5bd6d9c640c9012b78","user":{"login":"schiebel","id":8408745,"avatar_url":"https://avatars.githubusercontent.com/u/8408745?v=3","gravatar_id":"","url":"https://api.github.com/users/schiebel","html_url":"https://github.com/schiebel","followers_url":"https://api.github.com/users/schiebel/followers","following_url":"https://api.github.com/users/schiebel/following{/other_user}","gists_url":"https://api.github.com/users/schiebel/gists{/gist_id}","starred_url":"https://api.github.com/users/schiebel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schiebel/subscriptions","organizations_url":"https://api.github.com/users/schiebel/orgs","repos_url":"https://api.github.com/users/schiebel/repos","events_url":"https://api.github.com/users/schiebel/events{/privacy}","received_events_url":"https://api.github.com/users/schiebel/received_events","type":"User","site_admin":false},"repo":{"id":51030043,"name":"RxCpp","full_name":"schiebel/RxCpp","owner":{"login":"schiebel","id":8408745,"avatar_url":"https://avatars.githubusercontent.com/u/8408745?v=3","gravatar_id":"","url":"https://api.github.com/users/schiebel","html_url":"https://github.com/schiebel","followers_url":"https://api.github.com/users/schiebel/followers","following_url":"https://api.github.com/users/schiebel/following{/other_user}","gists_url":"https://api.github.com/users/schiebel/gists{/gist_id}","starred_url":"https://api.github.com/users/schiebel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schiebel/subscriptions","organizations_url":"https://api.github.com/users/schiebel/orgs","repos_url":"https://api.github.com/users/schiebel/repos","events_url":"https://api.github.com/users/schiebel/events{/privacy}","received_events_url":"https://api.github.com/users/schiebel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/schiebel/RxCpp","description":"Reactive Extensions for C++","fork":true,"url":"https://api.github.com/repos/schiebel/RxCpp","forks_url":"https://api.github.com/repos/schiebel/RxCpp/forks","keys_url":"https://api.github.com/repos/schiebel/RxCpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/schiebel/RxCpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/schiebel/RxCpp/teams","hooks_url":"https://api.github.com/repos/schiebel/RxCpp/hooks","issue_events_url":"https://api.github.com/repos/schiebel/RxCpp/issues/events{/number}","events_url":"https://api.github.com/repos/schiebel/RxCpp/events","assignees_url":"https://api.github.com/repos/schiebel/RxCpp/assignees{/user}","branches_url":"https://api.github.com/repos/schiebel/RxCpp/branches{/branch}","tags_url":"https://api.github.com/repos/schiebel/RxCpp/tags","blobs_url":"https://api.github.com/repos/schiebel/RxCpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/schiebel/RxCpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/schiebel/RxCpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/schiebel/RxCpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/schiebel/RxCpp/statuses/{sha}","languages_url":"https://api.github.com/repos/schiebel/RxCpp/languages","stargazers_url":"https://api.github.com/repos/schiebel/RxCpp/stargazers","contributors_url":"https://api.github.com/repos/schiebel/RxCpp/contributors","subscribers_url":"https://api.github.com/repos/schiebel/RxCpp/subscribers","subscription_url":"https://api.github.com/repos/schiebel/RxCpp/subscription","commits_url":"https://api.github.com/repos/schiebel/RxCpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/schiebel/RxCpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/schiebel/RxCpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/schiebel/RxCpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/schiebel/RxCpp/contents/{+path}","compare_url":"https://api.github.com/repos/schiebel/RxCpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/schiebel/RxCpp/merges","archive_url":"https://api.github.com/repos/schiebel/RxCpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/schiebel/RxCpp/downloads","issues_url":"https://api.github.com/repos/schiebel/RxCpp/issues{/number}","pulls_url":"https://api.github.com/repos/schiebel/RxCpp/pulls{/number}","milestones_url":"https://api.github.com/repos/schiebel/RxCpp/milestones{/number}","notifications_url":"https://api.github.com/repos/schiebel/RxCpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/schiebel/RxCpp/labels{/name}","releases_url":"https://api.github.com/repos/schiebel/RxCpp/releases{/id}","deployments_url":"https://api.github.com/repos/schiebel/RxCpp/deployments","created_at":"2016-02-03T20:57:06Z","updated_at":"2016-02-03T20:57:07Z","pushed_at":"2016-02-03T21:48:34Z","git_url":"git://github.com/schiebel/RxCpp.git","ssh_url":"git@github.com:schiebel/RxCpp.git","clone_url":"https://github.com/schiebel/RxCpp.git","svn_url":"https://github.com/schiebel/RxCpp","homepage":"","size":53796,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Reactive-Extensions:master","ref":"master","sha":"f07c06dc4509b697e76693606d63b28d642c8757","user":{"login":"Reactive-Extensions","id":984368,"avatar_url":"https://avatars.githubusercontent.com/u/984368?v=3","gravatar_id":"","url":"https://api.github.com/users/Reactive-Extensions","html_url":"https://github.com/Reactive-Extensions","followers_url":"https://api.github.com/users/Reactive-Extensions/followers","following_url":"https://api.github.com/users/Reactive-Extensions/following{/other_user}","gists_url":"https://api.github.com/users/Reactive-Extensions/gists{/gist_id}","starred_url":"https://api.github.com/users/Reactive-Extensions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reactive-Extensions/subscriptions","organizations_url":"https://api.github.com/users/Reactive-Extensions/orgs","repos_url":"https://api.github.com/users/Reactive-Extensions/repos","events_url":"https://api.github.com/users/Reactive-Extensions/events{/privacy}","received_events_url":"https://api.github.com/users/Reactive-Extensions/received_events","type":"Organization","site_admin":false},"repo":{"id":12584062,"name":"RxCpp","full_name":"Reactive-Extensions/RxCpp","owner":{"login":"Reactive-Extensions","id":984368,"avatar_url":"https://avatars.githubusercontent.com/u/984368?v=3","gravatar_id":"","url":"https://api.github.com/users/Reactive-Extensions","html_url":"https://github.com/Reactive-Extensions","followers_url":"https://api.github.com/users/Reactive-Extensions/followers","following_url":"https://api.github.com/users/Reactive-Extensions/following{/other_user}","gists_url":"https://api.github.com/users/Reactive-Extensions/gists{/gist_id}","starred_url":"https://api.github.com/users/Reactive-Extensions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reactive-Extensions/subscriptions","organizations_url":"https://api.github.com/users/Reactive-Extensions/orgs","repos_url":"https://api.github.com/users/Reactive-Extensions/repos","events_url":"https://api.github.com/users/Reactive-Extensions/events{/privacy}","received_events_url":"https://api.github.com/users/Reactive-Extensions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Reactive-Extensions/RxCpp","description":"Reactive Extensions for C++","fork":false,"url":"https://api.github.com/repos/Reactive-Extensions/RxCpp","forks_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/forks","keys_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/teams","hooks_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/hooks","issue_events_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues/events{/number}","events_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/events","assignees_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/assignees{/user}","branches_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/branches{/branch}","tags_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/tags","blobs_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/statuses/{sha}","languages_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/languages","stargazers_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/stargazers","contributors_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/contributors","subscribers_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/subscribers","subscription_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/subscription","commits_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/contents/{+path}","compare_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/merges","archive_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/downloads","issues_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues{/number}","pulls_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls{/number}","milestones_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/milestones{/number}","notifications_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/labels{/name}","releases_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/releases{/id}","deployments_url":"https://api.github.com/repos/Reactive-Extensions/RxCpp/deployments","created_at":"2013-09-04T06:56:36Z","updated_at":"2016-02-02T04:03:00Z","pushed_at":"2016-02-03T06:59:07Z","git_url":"git://github.com/Reactive-Extensions/RxCpp.git","ssh_url":"git@github.com:Reactive-Extensions/RxCpp.git","clone_url":"https://github.com/Reactive-Extensions/RxCpp.git","svn_url":"https://github.com/Reactive-Extensions/RxCpp","homepage":"","size":103737,"stargazers_count":331,"watchers_count":331,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":56,"mirror_url":null,"open_issues_count":7,"forks":56,"open_issues":7,"watchers":331,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/192"},"html":{"href":"https://github.com/Reactive-Extensions/RxCpp/pull/192"},"issue":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues/192"},"comments":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/issues/192/comments"},"review_comments":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/192/comments"},"review_comment":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/pulls/192/commits"},"statuses":{"href":"https://api.github.com/repos/Reactive-Extensions/RxCpp/statuses/1bcbe91e760800c14b280b5bd6d9c640c9012b78"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":121,"deletions":36,"changed_files":3}}