From faaf9f0e48071dcd86864c1bcdb1cf80f5271162 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 31 Jul 2023 11:27:28 +0100 Subject: [PATCH] [Minor] Add fmt::format specialisation --- src/client/rspamc.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx index bf7a23c474..e934efeb18 100644 --- a/src/client/rspamc.cxx +++ b/src/client/rspamc.cxx @@ -1,11 +1,11 @@ -/*- +/* * Copyright 2023 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -354,6 +354,14 @@ static constexpr auto emphasis_argument(const T &arg, int precision) -> auto return fmt::format("{:.{}f}", arg, precision); } +template<> +struct fmt::formatter : fmt::formatter { + auto format(rspamd_action_type c, format_context &ctx) const + { + return formatter::format(std::string_view{rspamd_action_to_str(c)}, ctx); + } +}; + using sort_lambda = std::function; static const auto sort_map = frozen::make_unordered_map({ {"name", [](const ucl_object_t *o1, const ucl_object_t *o2) -> int { -- 2.47.3