message: Decorate vectors and arrays through libfmt
diff: namespace fmt
  {
  - inline std::string uint8_vector_to_hex_string(const std::vector<uint8_t>& v)
  - {
  - std::stringstream ss;
  - for (auto it = v.begin(); it != v.end(); it++)
  - {
  - ss << std::hex << static_cast<unsigned>(*it);
  - }
  -
  - return ss.str();
  - }
  -
  template <>
  struct formatter<std::vector<uint8_t>>
  {
  @@ -30,14 +19,15 @@ namespace fmt
  }
  template <typename FormatContext>
  - auto format(const std::vector<uint8_t>& p, FormatContext& ctx)
  + auto format(const std::vector<uint8_t>& v, FormatContext& ctx)
  {
  - return format_to(ctx.out(), uint8_vector_to_hex_string(p));
  + return format_to(
  + ctx.out(), "<vec[{}]: {:02x}>", v.size(), fmt::join(v, " "));
  }
  };
  - template <>
  - struct formatter<std::array<uint8_t, 32>>
  + template <size_t N>
  + struct formatter<std::array<uint8_t, N>>
  {
  template <typename ParseContext>
  constexpr auto parse(ParseContext& ctx)
  @@ -46,10 +36,9 @@ namespace fmt
  }
  template <typename FormatContext>
  - auto format(const std::array<uint8_t, 32>& p, FormatContext& ctx)
  + auto format(const std::array<uint8_t, N>& a, FormatContext& ctx)
  {
  - return format_to(
  - ctx.out(), uint8_vector_to_hex_string({p.begin(), p.end()}));
  + return format_to(ctx.out(), "<arr[{}]: {:02x}>", N, fmt::join(a, " "));
  }
  };
  }
  