rgw: specialize fmt::formatter<> for rgw_obj_key

since fmt v9, fmt::formatter<> is not specialized for the types with
operator<<(ostream&, ...) anymore. so we need to specialize it manually.
in this change, fmt::formatter<rgw_obj_key> is defined so the tree can
compile with fmt v9.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2022-12-02 17:23:23 +08:00
parent b1382d0a23
commit c7e3e95277

View File

@ -397,6 +397,13 @@ inline std::ostream& operator<<(std::ostream& out, const rgw_obj_key &o) {
return out << o.to_str();
}
template<> struct fmt::formatter<rgw_obj_key> : fmt::formatter<std::string_view> {
template <typename FormatContext>
auto format(const rgw_obj_key& key, FormatContext& ctx) const {
return formatter<std::string_view>::format(key.to_str(), ctx);
}
};
struct rgw_raw_obj {
rgw_pool pool;
std::string oid;