mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-24 00:32:15 +00:00
sstables: Implement fmt::formatter<sstable_format_types>
Same as in previous patch for another enum-class type. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -2040,7 +2040,7 @@ sstring sstable::component_basename(const sstring& ks, const sstring& cf, versio
|
||||
format_types format, sstring component) {
|
||||
sstring v = fmt::to_string(version);
|
||||
sstring g = to_sstring(generation);
|
||||
sstring f = format_string.at(format);
|
||||
sstring f = fmt::to_string(format);
|
||||
switch (version) {
|
||||
case sstable::version_types::ka:
|
||||
return ks + "-" + cf + "-" + v + "-" + g + "-" + component;
|
||||
|
||||
@@ -96,3 +96,11 @@ struct fmt::formatter<sstables::sstable_version_types> : fmt::formatter<std::str
|
||||
return fmt::format_to(ctx.out(), "{}", sstables::version_string.at(version));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<sstables::sstable_format_types> : fmt::formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const sstables::sstable_format_types& format, FormatContext& ctx) const {
|
||||
return fmt::format_to(ctx.out(), "{}", sstables::format_string.at(format));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user