mirror of
https://gitlab.com/niansa/libcrosscoro.git
synced 2025-03-06 20:53:32 +01:00
* udp_peer! I hope using the udp peer makes sense on how udp packets are sent and received now. Time will tell! * Fix broken benchmark tcp server listening race condition
27 lines
678 B
C++
27 lines
678 B
C++
#pragma once
|
|
|
|
#include "coro/concepts/awaitable.hpp"
|
|
|
|
#include <concepts>
|
|
|
|
namespace coro::concepts
|
|
{
|
|
|
|
// clang-format off
|
|
template<typename type, typename return_type>
|
|
concept promise = requires(type t)
|
|
{
|
|
{ t.get_return_object() } -> std::convertible_to<std::coroutine_handle<>>;
|
|
{ t.initial_suspend() } -> awaiter;
|
|
{ t.final_suspend() } -> awaiter;
|
|
{ t.yield_value() } -> awaitable;
|
|
}
|
|
&& requires(type t, return_type return_value)
|
|
{
|
|
std::same_as<decltype(t.return_void()), void> ||
|
|
std::same_as<decltype(t.return_value(return_value)), void> ||
|
|
requires { t.yield_value(return_value); };
|
|
};
|
|
// clang-format on
|
|
|
|
} // namespace coro::concepts
|