summaryrefslogtreecommitdiff
path: root/include/fud_drain.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-30 09:51:54 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-30 09:51:54 -0500
commit6c7fd1db481ff10a16ecab958c6542784fa60b9c (patch)
treee0162f930ec44a7c53b07061311d52910c36e481 /include/fud_drain.hpp
parent8dcb1de91e15ff7fc66279cd9cd9ad8a70f624e0 (diff)
Use std::byte* instead of void* for allocators.
Diffstat (limited to 'include/fud_drain.hpp')
-rw-r--r--include/fud_drain.hpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/fud_drain.hpp b/include/fud_drain.hpp
index 5b78b10..d630bc7 100644
--- a/include/fud_drain.hpp
+++ b/include/fud_drain.hpp
@@ -26,8 +26,18 @@
namespace fud {
struct DrainResult {
- size_t bytesWritten;
+ size_t bytesDrained;
FudStatus status;
+ [[nodiscard]] constexpr bool isOkay()
+ {
+ return status == FudStatus::Success;
+ }
+};
+
+template <typename Sink, typename Source>
+concept Drainable = requires (Sink sink, Source source)
+{
+ { sink.drain(source) } -> std::same_as<DrainResult>;
};
} // namespace fud