File indexing completed on 2025-12-16 10:08:24
0001
0002
0003
0004
0005
0006
0007 #include <boost/redis/response.hpp>
0008 #include <boost/redis/error.hpp>
0009 #include <boost/assert.hpp>
0010
0011 namespace boost::redis
0012 {
0013
0014 void consume_one(generic_response& r, system::error_code& ec)
0015 {
0016 if (r.has_error())
0017 return;
0018
0019 if (std::empty(r.value()))
0020 return;
0021
0022 auto const depth = r.value().front().depth;
0023
0024
0025
0026
0027 if (depth != 0) {
0028 ec = error::incompatible_node_depth;
0029 return;
0030 }
0031
0032 auto f = [depth](auto const& e)
0033 { return e.depth == depth; };
0034
0035 auto match = std::find_if(std::next(std::cbegin(r.value())), std::cend(r.value()), f);
0036
0037 r.value().erase(std::cbegin(r.value()), match);
0038 }
0039
0040 void consume_one(generic_response& r)
0041 {
0042 system::error_code ec;
0043 consume_one(r, ec);
0044 if (ec)
0045 throw system::system_error(ec);
0046 }
0047
0048 }