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 <kefu.chai@scylladb.com>

Closes scylladb/scylladb#17013
This commit is contained in:
Kefu Chai
2024-01-27 22:31:28 +08:00
committed by Botond Dénes
parent 3abdb3c7ee
commit b5ff098f28

View File

@@ -48,6 +48,8 @@
#include "db/config.hh"
#include "locator/abstract_replication_strategy.hh"
#include <fmt/ostream.h>
#ifdef THRIFT_USES_BOOST
namespace thrift_fn = tcxx;
#else
@@ -63,6 +65,8 @@ using namespace ::cassandra;
using namespace thrift;
template <> struct fmt::formatter<cassandra::ConsistencyLevel::type> : fmt::ostream_formatter {};
class unimplemented_exception : public std::exception {
public:
virtual const char* what() const throw () override { return "sorry, not implemented"; }