10USERVER_NAMESPACE_BEGIN
 
   12namespace utils::statistics {
 
   17class LabelView 
final {
 
   19  LabelView() = 
default;
 
   20  LabelView(Label&& label) = 
delete;
 
   21  explicit LabelView(
const Label& label) 
noexcept;
 
   22  LabelView(std::string_view name, std::string_view value) 
noexcept 
   23      : name_(name), value_(value) {}
 
   25  explicit operator 
bool() 
const { 
return !name_.empty(); }
 
   27  std::string_view Name() 
const { 
return name_; }
 
   28  std::string_view Value() 
const { 
return value_; }
 
   31  std::string_view name_;
 
   32  std::string_view value_;
 
   35bool operator<(
const LabelView& x, 
const LabelView& y) 
noexcept;
 
   36bool operator==(
const LabelView& x, 
const LabelView& y) 
noexcept;
 
   42  explicit Label(LabelView view);
 
   43  Label(std::string name, std::string value);
 
   45  explicit operator 
bool() 
const { 
return !name_.empty(); }
 
   46  explicit operator LabelView() 
const { 
return {name_, value_}; }
 
   48  const std::string& Name() 
const { 
return name_; }
 
   49  const std::string& Value() 
const& { 
return value_; }
 
   50  std::string& Value() & { 
return value_; }
 
   51  std::string&& Value() && { 
return std::move(value_); }
 
   58bool operator<(
const Label& x, 
const Label& y) 
noexcept;
 
   59bool operator==(
const Label& x, 
const Label& y) 
noexcept;
 
   62class LabelsSpan 
final {
 
   64  using iterator = 
const LabelView*;
 
   65  using const_iterator = 
const LabelView*;
 
   67  LabelsSpan() = 
default;
 
   68  LabelsSpan(
const LabelView* begin, 
const LabelView* end) 
noexcept;
 
   69  LabelsSpan(std::initializer_list<LabelView> il) 
noexcept 
   70      : LabelsSpan(il.begin(), il.end()) {}
 
   72  template <
class Container>
 
   74      const Container& cont,
 
   75      std::enable_if_t<std::is_same_v<
decltype(*(cont.data() + cont.size())),
 
   76                                      const LabelView&>>* = 
nullptr) 
noexcept 
   77      : LabelsSpan(cont.data(), cont.data() + cont.size()) {}
 
   79  const LabelView* begin() 
const noexcept { 
return begin_; }
 
   80  const LabelView* end() 
const noexcept { 
return end_; }
 
   81  std::size_t size() 
const noexcept { 
return end_ - begin_; }
 
   82  bool empty() 
const noexcept { 
return end_ == begin_; }
 
   85  const LabelView* begin_{
nullptr};
 
   86  const LabelView* end_{
nullptr};