diff --git a/include/continuable/continuable.hpp b/include/continuable/continuable.hpp index 76ca6c5..3138878 100644 --- a/include/continuable/continuable.hpp +++ b/include/continuable/continuable.hpp @@ -63,14 +63,14 @@ using continuable = typename detail::trait_of< Args... >::continuable; -/// Defines a copyable callback type which uses the -/// function2 backend for the continuable type erasure. +/// Defines a non-copyable continuation type which uses the +/// function2 backend for type erasure. /// -/// Usable like: `callback` -// template -// using promise = typename detail::trait_of< -// Args... -// >::promise; +/// Usable like: `unique_continuable` +template +using unique_continuable = typename detail::unique_trait_of< + Args... +>::continuable; /// Defines a non-copyable promise type which using the /// function2 backend for type erasure. @@ -81,15 +81,6 @@ using promise = typename detail::unique_trait_of< Args... >::promise; -/// Defines a non-copyable callback type which uses the -/// function2 backend for the continuable type erasure. -/// -/// Usable like: `unique_callback` -template -using unique_callback = typename detail::unique_trait_of< - Args... ->::callback; - // TODO channel // TODO sink diff --git a/test/playground/test-playground.cpp b/test/playground/test-playground.cpp index e15ee6d..4c78fb6 100644 --- a/test/playground/test-playground.cpp +++ b/test/playground/test-playground.cpp @@ -35,9 +35,7 @@ static cti::continuable http_request(std::string url) { }; } -/* - // TODO Fix this -static cti::continuable http_request(std::string url) { +static cti::continuable http_request3(std::string url) { return [url = std::move(url)](auto promise) { if (false) { promise.set_value(""); @@ -46,7 +44,6 @@ static cti::continuable http_request(std::string url) { promise.set_exception(std::error_condition{}); }; } -*/ static auto http_request2(std::string url) { return cti::make_continuable( @@ -101,5 +98,13 @@ int main(int, char**) { // ... }); + (http_request("github.com") >> http_request("github.com")) + .then([](std::string, std::string) { + // ... + }) + .fail([](std::error_condition) { + // ... + }); + return 0; }