diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-09-22 22:47:33 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-09-22 22:47:33 +0200 |
| commit | d05b9343f69a0841043963088e0003368e205bd9 (patch) | |
| tree | 8cde07ff86d27cbc808a0a149b89d0024b4a586c /ttwhy/core/concepts.cppm | |
| parent | 22f6534081acfabdab4956d337604a21e7da5b64 (diff) | |
| download | ttwhy-d05b9343f69a0841043963088e0003368e205bd9.tar.xz ttwhy-d05b9343f69a0841043963088e0003368e205bd9.zip | |
Diffstat (limited to 'ttwhy/core/concepts.cppm')
| -rw-r--r-- | ttwhy/core/concepts.cppm | 30 |
1 files changed, 30 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 |
