Fix printing OpNum that are not in default magic_enum range

This commit is contained in:
Alexander Gololobov 2024-04-09 18:18:27 +02:00
parent 4895a7de77
commit fdfee8e905

View File

@ -2,6 +2,7 @@
#include <string> #include <string>
#include <cstdint> #include <cstdint>
#include <magic_enum.hpp>
namespace Coordination namespace Coordination
@ -64,3 +65,11 @@ static constexpr int32_t DEFAULT_OPERATION_TIMEOUT_MS = 10000;
static constexpr int32_t DEFAULT_CONNECTION_TIMEOUT_MS = 1000; static constexpr int32_t DEFAULT_CONNECTION_TIMEOUT_MS = 1000;
} }
/// This is used by fmt::format to print OpNum as strings.
/// All OpNum values shoud be in range [min, max] to be printed.
template <>
struct magic_enum::customize::enum_range<Coordination::OpNum> {
static constexpr int min = -100;
static constexpr int max = 1000;
};