8#include <userver/compiler/thread_local.hpp>
9#include <userver/utils/encoding/tskv_parser.hpp>
11USERVER_NAMESPACE_BEGIN
13namespace utils::encoding {
17struct TskvParserKvStorage {
22inline compiler::ThreadLocal tskv_parser_kv_storage = [] {
return TskvParserKvStorage{}; };
37template <
typename TagConsumer>
41 auto kv_storage = impl::tskv_parser_kv_storage.Use();
44 if (
const auto key_status = parser.ReadKey(kv_storage->key)) {
48 const auto value_status = parser.ReadValue(kv_storage->value);
49 if (value_status == RecordStatus::kIncomplete) {
53 const bool record_ok = consumer(std::as_const(kv_storage->key), std::as_const(kv_storage->value));
54 if (value_status == RecordStatus::kReachedEnd) {