7#ifndef BOOST_REDIS_RESP3_PARSER_HPP
8#define BOOST_REDIS_RESP3_PARSER_HPP
10#include <boost/redis/resp3/node.hpp>
11#include <boost/system/error_code.hpp>
18namespace boost::redis::resp3 {
20using int_type = std::uint64_t;
24 using node_type = basic_node<std::string_view>;
25 using result = std::optional<node_type>;
27 static constexpr std::size_t max_embedded_depth = 5;
28 static constexpr std::string_view sep =
"\r\n";
34 std::size_t depth_ = 0;
39 std::array<std::size_t, max_embedded_depth + 1> sizes_ = {{1}};
42 int_type bulk_length_ = (std::numeric_limits<unsigned long>::max)();
49 std::size_t consumed_ = 0;
52 auto consume_impl(
type t, std::string_view elem, system::error_code& ec) -> node_type;
54 void commit_elem() noexcept;
59 auto bulk_expected() const noexcept ->
bool
67 auto done() const noexcept ->
bool;
69 auto get_suggested_buffer_growth(std::
size_t hint) const noexcept -> std::
size_t;
71 auto get_consumed() const noexcept -> std::
size_t;
73 auto consume(std::string_view view, system::error_code& ec) noexcept ->
result;
76template <class Adapter>
80 std::string_view const& msg,
82 system::error_code& ec)
85 auto const res = p.consume(msg, ec);
92 adapter(res.value(), ec);
system::result< Value, error > result
Stores response to individual Redis commands.