7#include "../utility/utility.hpp"
8#include "../macros.hpp"
12hi_export_module(hikogui.dispatch.awaitable);
14hi_export
namespace hi::inline
v1 {
22concept awaitable =
requires(std::remove_reference_t<T>& a, std::coroutine_handle<> b) {
24 { a.await_ready() } -> std::convertible_to<bool>;
45 template<
typename RHS>
46 decltype(
auto)
operator()(RHS&& rhs)
const noexcept
48 return std::forward<RHS>(rhs);
52template<awaitable_with_co_await_member T>
54 template<
typename RHS>
55 decltype(
auto)
operator()(RHS&& rhs)
const noexcept
57 return std::forward<RHS>(rhs).operator
co_await();
61template<awaitable_with_co_await_free_function T>
62struct awaitable_cast<T> {
63 template<
typename RHS>
64 decltype(
auto)
operator()(RHS&& rhs)
const noexcept
66 return operator co_await(std::forward<RHS>(rhs));
73concept convertible_to_awaitable =
requires(std::remove_reference_t<T>& rhs) { awaitable_cast<std::remove_cvref_t<T>>{}(rhs); };
81 using type =
decltype(std::declval<T>().await_resume());
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
await_resume_result< T >::type await_resume_result_t
Get the result type of an awaitable.
Definition awaitable.hpp:89
Definition awaitable.hpp:41
Get the result type of an awaitable.
Definition awaitable.hpp:80
Check if type can be directly co_await on.
Definition awaitable.hpp:22
Definition awaitable.hpp:31
Definition awaitable.hpp:36
Check if type can be casted with awaitable_cast to an awaitable.
Definition awaitable.hpp:73