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, Deadline deadline
= {});
75 size_t FillBuffer(Deadline deadline);
77 ReadableBasePtr source_;
79 constexpr static std::size_t kBufferSize = compiler::SelectSize()
82 constexpr static std::size_t kBufferAlignment =
alignof(
void*);
83 utils::FastPimpl<impl::Buffer, kBufferSize, kBufferAlignment,
true> buffer_;