7#ifndef BOOST_REDIS_RESP3_PARSER_HPP
8#define BOOST_REDIS_RESP3_PARSER_HPP
10#include <boost/redis/resp3/node.hpp>
12#include <boost/system/error_code.hpp>
19namespace boost::redis::resp3 {
23 using node_type = basic_node<std::string_view>;
24 using result = std::optional<node_type>;
26 static constexpr std::size_t max_embedded_depth = 5;
27 static constexpr std::string_view sep =
"\r\n";
38 std::array<std::size_t, max_embedded_depth + 1> sizes_;
41 std::size_t bulk_length_;
48 std::size_t consumed_;
51 auto consume_impl(
type t, std::string_view elem, system::error_code& ec) -> node_type;
53 void commit_elem() noexcept;
58 auto bulk_expected() const noexcept ->
bool
68 auto done() const noexcept ->
bool;
70 auto get_suggested_buffer_growth(std::
size_t hint) const noexcept -> std::
size_t;
72 auto get_consumed() const noexcept -> std::
size_t;
74 auto consume(std::string_view view, system::error_code& ec) noexcept -> result;
82template <class Adapter>
83bool parse(resp3::parser& p, std::string_view const& msg, Adapter& adapter, system::error_code& ec)
86 auto const res = p.consume(msg, ec);
93 adapter(res.value(), ec);