From b5ff098f280bc01ce27c378da87fe42c3992b7ff Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 27 Jan 2024 22:31:28 +0800 Subject: [PATCH] thrift: add formatter for cassandra::ConsistencyLevel::type 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, we define formatters for cassandra::ConsistencyLevel::type. please note, the operator<< for `cassandra::ConsistencyLevel::type` is generated using `thrift` command line tool, which does not emit specialization for fmt::formatter yet, so we need to use `fmt::ostream_formatter` to implement the formatter for this type. Refs #13245 Signed-off-by: Kefu Chai Closes scylladb/scylladb#17013 --- thrift/handler.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thrift/handler.cc b/thrift/handler.cc index e145e677ed..c7859d54b9 100644 --- a/thrift/handler.cc +++ b/thrift/handler.cc @@ -48,6 +48,8 @@ #include "db/config.hh" #include "locator/abstract_replication_strategy.hh" +#include + #ifdef THRIFT_USES_BOOST namespace thrift_fn = tcxx; #else @@ -63,6 +65,8 @@ using namespace ::cassandra; using namespace thrift; +template <> struct fmt::formatter : fmt::ostream_formatter {}; + class unimplemented_exception : public std::exception { public: virtual const char* what() const throw () override { return "sorry, not implemented"; }