diff options
Diffstat (limited to 'ttwhy/core')
| -rw-r--r-- | ttwhy/core/concepts.cppm | 30 | ||||
| -rw-r--r-- | ttwhy/core/mod.cppm | 3 |
2 files changed, 33 insertions, 0 deletions
diff --git a/ttwhy/core/concepts.cppm b/ttwhy/core/concepts.cppm new file mode 100644 index 0000000..f7ac583 --- /dev/null +++ b/ttwhy/core/concepts.cppm @@ -0,0 +1,30 @@ +module; + +#include <asio.hpp> + +#include <concepts> +#include <span> + +export module ttwhy.core:concepts; + +namespace ttwhy +{ + + export template<typename Candidate> + concept scanner = requires(Candidate a, std::span<char const> buffer) { + { a.process(buffer) } -> std::same_as<void>; + { a.timeout() } -> std::same_as<void>; + { a.is_pending() } -> std::same_as<bool>; + }; + + export template<typename Candidate, typename Event> + concept router = requires(Candidate candidate, Event event) { + { candidate.process(event) } -> std::same_as<asio::awaitable<void>>; + }; + + export template<typename Sink, typename Event> + concept event_sink = requires(Sink sink, Event event) { + { sink(event) } -> std::same_as<void>; + }; + +} // namespace ttwhy diff --git a/ttwhy/core/mod.cppm b/ttwhy/core/mod.cppm new file mode 100644 index 0000000..a6bf056 --- /dev/null +++ b/ttwhy/core/mod.cppm @@ -0,0 +1,3 @@ +export module ttwhy.core; + +export import :concepts; |
