mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
more mocks
This commit is contained in:
parent
b67ca1c224
commit
75b5ecad9d
@ -48,7 +48,7 @@ namespace cti {
|
|||||||
/// | `continuable_base with <Arg>` | `std::future<Arg>` |
|
/// | `continuable_base with <Arg>` | `std::future<Arg>` |
|
||||||
/// | `continuable_base with <Args...>` | `std::future<std::tuple<Args...>>` |
|
/// | `continuable_base with <Args...>` | `std::future<std::tuple<Args...>>` |
|
||||||
///
|
///
|
||||||
/// \alert If exceptions are used, exceptions that are thrown are forwarded
|
/// \alert If exceptions are used, exceptions that are thrown, are forwarded
|
||||||
/// to the returned future. If there are no exceptions supported,
|
/// to the returned future. If there are no exceptions supported,
|
||||||
/// you shall not pass any errors to the end of the asynchronous
|
/// you shall not pass any errors to the end of the asynchronous
|
||||||
/// call chain!
|
/// call chain!
|
||||||
|
|||||||
@ -25,22 +25,48 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
template <typename... A> struct continuable {
|
template <typename... A>
|
||||||
template <typename T = int> continuable(T&& = 0) {}
|
struct continuable {
|
||||||
|
template <typename T = int>
|
||||||
|
continuable(T&& = 0) {
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> continuable& then(T&&) { return *this; }
|
template <typename T>
|
||||||
|
continuable& then(T&&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> continuable& dropped(T&&) { return *this; }
|
template <typename T>
|
||||||
|
continuable& dropped(T&&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> continuable& thrown(T&&) { return *this; }
|
template <typename T>
|
||||||
|
continuable& thrown(T&&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> continuable& failed(T&&) { return *this; }
|
template <typename T>
|
||||||
|
continuable& failed(T&&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
continuable& operator|(T&&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename... A> struct promise {
|
template <typename... Args>
|
||||||
void set_value(A...) noexcept {}
|
using channel = continuable<Args...>;
|
||||||
|
|
||||||
void operator()(A...) && noexcept {}
|
template <typename... A>
|
||||||
|
struct promise {
|
||||||
|
void set_value(A...) noexcept {
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(A...) && noexcept {
|
||||||
|
}
|
||||||
|
|
||||||
void set_exception(std::exception_ptr exception) noexcept {
|
void set_exception(std::exception_ptr exception) noexcept {
|
||||||
// ...
|
// ...
|
||||||
@ -52,12 +78,16 @@ template <typename... A> struct promise {
|
|||||||
(void)error;
|
(void)error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cancel() noexcept {}
|
void cancel() noexcept {
|
||||||
|
}
|
||||||
|
|
||||||
bool is_canceled() const noexcept { return false; }
|
bool is_canceled() const noexcept {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename... Result> struct accumulator {
|
template <typename... Result>
|
||||||
|
struct accumulator {
|
||||||
auto accumulate() {
|
auto accumulate() {
|
||||||
return [] {};
|
return [] {};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user