cql3: add fmt::formatter for cql3_type and cql3_type::raw

before this change, we rely on the default-generated fmt::formatter
created from operator<<, but fmt v10 dropped the default-generated
formatter.

in this change, `fmt::formatter<>` is added for following classes:

* `cql3::cql3_type`
* `cql3::cql3_type::raw`

Refs #13245

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#17945
This commit is contained in:
Kefu Chai
2024-03-21 13:38:16 +08:00
committed by Nadav Har'El
parent fdeb14b468
commit 8dacec589d

View File

@@ -363,3 +363,17 @@ inline bool operator==(const cql3_type& a, const cql3_type& b) {
#endif
}
template <>
struct fmt::formatter<cql3::cql3_type>: fmt::formatter<std::string_view> {
auto format(const cql3::cql3_type& t, fmt::format_context& ctx) const {
return formatter<std::string_view>::format(format_as(t), ctx);
}
};
template <std::derived_from<cql3::cql3_type::raw> T>
struct fmt::formatter<T>: fmt::formatter<std::string_view> {
auto format(const T& t, fmt::format_context& ctx) const {
return formatter<std::string_view>::format(format_as(t), ctx);
}
};