mutation: add fmt::formatter for frozen_mutation::printer

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 frozen_mutation::printer,
and drop its operator.

Refs #13245

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
Kefu Chai
2024-03-10 21:26:28 +08:00
parent 94d25e02ad
commit acd14f12f0
2 changed files with 6 additions and 5 deletions

View File

@@ -147,10 +147,6 @@ mutation_partition_view frozen_mutation::partition() const {
return mutation_partition_view::from_view(mutation_view().partition());
}
std::ostream& operator<<(std::ostream& out, const frozen_mutation::printer& pr) {
return out << pr.self.unfreeze(pr.schema);
}
frozen_mutation::printer frozen_mutation::pretty_printer(schema_ptr s) const {
return { *this, std::move(s) };
}

View File

@@ -222,7 +222,6 @@ public:
struct printer {
const frozen_mutation& self;
schema_ptr schema;
friend std::ostream& operator<<(std::ostream&, const printer&);
};
// Same requirements about the schema as unfreeze().
@@ -323,3 +322,9 @@ auto frozen_mutation::consume_gently(schema_ptr s, Consumer& consumer) const ->
frozen_mutation_consumer_adaptor adaptor(s, consumer);
co_return co_await consume_gently(s, adaptor);
}
template <> struct fmt::formatter<frozen_mutation::printer> : fmt::formatter<std::string_view> {
auto format(const frozen_mutation::printer& pr, fmt::format_context& ctx) const {
return fmt::format_to(ctx.out(), "{}", pr.self.unfreeze(pr.schema));
}
};