9#include <userver/compiler/select.hpp>
10#include <userver/engine/deadline.hpp>
11#include <userver/engine/io/common.hpp>
12#include <userver/engine/io/exception.hpp>
13#include <userver/utils/fast_pimpl.hpp>
14#include <userver/utils/function_ref.hpp>
16USERVER_NAMESPACE_BEGIN
27 TerminatorNotFoundException();
31class BufferedReader
final {
41 BufferedReader(BufferedReader&&)
noexcept;
42 BufferedReader& operator=(BufferedReader&&)
noexcept;
48 std::string
ReadSome(size_t max_bytes, Deadline deadline
= {});
52 std::string
ReadAll(size_t num_bytes, Deadline deadline
= {});
63 std::string
ReadUntil(utils::function_ref<
bool(
int)
const> pred,
64 Deadline deadline
= {});
76 size_t FillBuffer(Deadline deadline);
78 ReadableBasePtr source_;
80 constexpr static std::size_t kBufferSize = compiler::SelectSize()
83 constexpr static std::size_t kBufferAlignment =
alignof(
void*);
84 utils::FastPimpl<impl::Buffer, kBufferSize, kBufferAlignment,
true> buffer_;