aboutsummaryrefslogtreecommitdiff
path: root/ttwhy/core
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2026-09-22 22:47:33 +0200
committerFelix Morgner <felix.morgner@gmail.com>2026-09-22 22:47:33 +0200
commitd05b9343f69a0841043963088e0003368e205bd9 (patch)
tree8cde07ff86d27cbc808a0a149b89d0024b4a586c /ttwhy/core
parent22f6534081acfabdab4956d337604a21e7da5b64 (diff)
downloadttwhy-d05b9343f69a0841043963088e0003368e205bd9.tar.xz
ttwhy-d05b9343f69a0841043963088e0003368e205bd9.zip
lib: restructure into vertical slicesHEADmaster
Diffstat (limited to 'ttwhy/core')
-rw-r--r--ttwhy/core/concepts.cppm30
-rw-r--r--ttwhy/core/mod.cppm3
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;