mirror of
https://github.com/Naios/continuable.git
synced 2025-12-07 01:06:44 +08:00
Rename flow -> next
This commit is contained in:
parent
b4332b66c5
commit
95d5f25f84
@ -292,7 +292,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// // Will receive errors and results
|
/// // Will receive errors and results
|
||||||
/// http_request("github.com")
|
/// http_request("github.com")
|
||||||
/// .flow(my_callable{});
|
/// .next(my_callable{});
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// \param executor The optional executor which is used to dispatch
|
/// \param executor The optional executor which is used to dispatch
|
||||||
@ -303,7 +303,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// \since version 2.0.0
|
/// \since version 2.0.0
|
||||||
template <typename T, typename E = detail::types::this_thread_executor_tag>
|
template <typename T, typename E = detail::types::this_thread_executor_tag>
|
||||||
auto flow(T&& callback,
|
auto next(T&& callback,
|
||||||
E&& executor = detail::types::this_thread_executor_tag{}) && {
|
E&& executor = detail::types::this_thread_executor_tag{}) && {
|
||||||
return detail::base::chain_continuation<
|
return detail::base::chain_continuation<
|
||||||
detail::base::handle_results::yes,
|
detail::base::handle_results::yes,
|
||||||
@ -653,10 +653,10 @@ auto make_continuable(Continuation&& continuation) {
|
|||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// // Will receive errors and results
|
/// // Will receive errors and results
|
||||||
/// continuable.flow(my_callable{});
|
/// continuable.next(my_callable{});
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// \note see continuable::flow for details.
|
/// \note see continuable::next for details.
|
||||||
///
|
///
|
||||||
/// \since version 2.0.0
|
/// \since version 2.0.0
|
||||||
using detail::types::dispatch_error_tag;
|
using detail::types::dispatch_error_tag;
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public:
|
|||||||
void await_suspend(coroutine_handle<> h) {
|
void await_suspend(coroutine_handle<> h) {
|
||||||
// Forward every result to the current awaitable
|
// Forward every result to the current awaitable
|
||||||
std::move(continuable_)
|
std::move(continuable_)
|
||||||
.flow([h, this](auto&&... args) {
|
.next([h, this](auto&&... args) {
|
||||||
resolve(std::forward<decltype(args)>(args)...);
|
resolve(std::forward<decltype(args)>(args)...);
|
||||||
h.resume();
|
h.resume();
|
||||||
})
|
})
|
||||||
|
|||||||
@ -129,7 +129,7 @@ auto as_future(continuable_base<Data, Annotation>&& continuable) {
|
|||||||
auto future = callback.get_future();
|
auto future = callback.get_future();
|
||||||
|
|
||||||
// Dispatch the continuation with the promise resolving callback
|
// Dispatch the continuation with the promise resolving callback
|
||||||
std::move(continuable).flow(std::move(callback)).done();
|
std::move(continuable).next(std::move(callback)).done();
|
||||||
|
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ struct my_callable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int main(int, char**) {
|
int main(int, char**) {
|
||||||
http_request("github.com").flow(my_callable{});
|
http_request("github.com").next(my_callable{});
|
||||||
|
|
||||||
http_request("github.com") | [](std::string) {
|
http_request("github.com") | [](std::string) {
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
@ -65,7 +65,7 @@ TYPED_TEST(single_dimension_tests, are_yielding_errors_from_handlers) {
|
|||||||
TYPED_TEST(single_dimension_tests, are_result_error_accepting) {
|
TYPED_TEST(single_dimension_tests, are_result_error_accepting) {
|
||||||
auto handled = std::make_shared<bool>(false);
|
auto handled = std::make_shared<bool>(false);
|
||||||
auto continuation = this->supply(supply_test_exception())
|
auto continuation = this->supply(supply_test_exception())
|
||||||
.flow(fu2::overload(
|
.next(fu2::overload(
|
||||||
[handled] {
|
[handled] {
|
||||||
ASSERT_FALSE(*handled);
|
ASSERT_FALSE(*handled);
|
||||||
*handled = true;
|
*handled = true;
|
||||||
@ -83,7 +83,7 @@ TYPED_TEST(single_dimension_tests, are_flow_error_accepting) {
|
|||||||
auto handled = std::make_shared<bool>(false);
|
auto handled = std::make_shared<bool>(false);
|
||||||
auto continuation =
|
auto continuation =
|
||||||
this->supply_exception(supply_test_exception())
|
this->supply_exception(supply_test_exception())
|
||||||
.flow(fu2::overload(
|
.next(fu2::overload(
|
||||||
[] {
|
[] {
|
||||||
// ...
|
// ...
|
||||||
FAIL();
|
FAIL();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user