diff --git a/AK/Stream.h b/AK/Stream.h index bc2db6f12d9..5fbe0bee433 100644 --- a/AK/Stream.h +++ b/AK/Stream.h @@ -7,9 +7,11 @@ #pragma once +#include #include #include #include +#include #include namespace AK { @@ -47,6 +49,12 @@ public: /// contents are written or an error occurs. virtual ErrorOr write_until_depleted(ReadonlyBytes); + template + ErrorOr write_until_depleted(T const& buffer) + { + return write_until_depleted(StringView { buffer }.bytes()); + } + template requires(requires(Stream& stream) { { T::read_from_stream(stream) } -> SameAs>; }) ErrorOr read_value()