add missing formatter for Snowflake

This commit is contained in:
ouwou
2023-05-30 19:08:35 -04:00
parent 366e72cc2a
commit 62d04b9993

View File

@@ -2,6 +2,7 @@
#include <cstdint>
#include <nlohmann/json.hpp>
#include <glibmm/ustring.h>
#include <fmt/core.h>
struct Snowflake {
Snowflake();
@@ -39,6 +40,13 @@ private:
unsigned long long m_num;
};
template<>
struct fmt::formatter<Snowflake> : fmt::formatter<std::string> {
auto format(Snowflake id, format_context &ctx) -> decltype(ctx.out()) {
return format_to(ctx.out(), "[id: {}]", static_cast<uint64_t>(id));
}
};
namespace std {
template<>
struct hash<Snowflake> {