diff options
Diffstat (limited to 'include/fud_drain.hpp')
-rw-r--r-- | include/fud_drain.hpp | 12 |
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 |