mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
add fmt:: namespace to distinguish from std::format_to (#43)
When compiled with new toolchain that implements std::format_to, it become ambiguous on which one should be called. Due to argument-dependent lookup, even if we are not `using namespace std;` the std version is still considered. So let's add fmt:: to avoid ambiguous compilation error.
This commit is contained in:
@@ -80,11 +80,11 @@ struct formatter<hf3fs::flat::UserInfo> : formatter<std::string_view> {
|
||||
auto format(const hf3fs::flat::UserInfo &user, FormatContext &ctx) const {
|
||||
auto groups = transformTo<std::vector>(std::span{user.groups.begin(), user.groups.size()},
|
||||
[](hf3fs::flat::Gid gid) { return gid.toUnderType(); });
|
||||
return format_to(ctx.out(),
|
||||
"(uid {}, gid {}, groups ({}))",
|
||||
user.uid.toUnderType(),
|
||||
user.gid.toUnderType(),
|
||||
fmt::join(groups.begin(), groups.end(), ","));
|
||||
return fmt::format_to(ctx.out(),
|
||||
"(uid {}, gid {}, groups ({}))",
|
||||
user.uid.toUnderType(),
|
||||
user.gid.toUnderType(),
|
||||
fmt::join(groups.begin(), groups.end(), ","));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ template <>
|
||||
struct formatter<hf3fs::meta::InodeType> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(hf3fs::meta::InodeType type, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "{}", magic_enum::enum_name(type));
|
||||
return fmt::format_to(ctx.out(), "{}", magic_enum::enum_name(type));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -444,7 +444,7 @@ template <>
|
||||
struct formatter<hf3fs::meta::ChunkId> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(hf3fs::meta::ChunkId chunk, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "{}-{}-{}", chunk.inode(), chunk.track(), chunk.chunk());
|
||||
return fmt::format_to(ctx.out(), "{}-{}-{}", chunk.inode(), chunk.track(), chunk.chunk());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -452,7 +452,7 @@ template <>
|
||||
struct formatter<hf3fs::meta::Layout::ChunkSize> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(hf3fs::meta::Layout::ChunkSize chunk, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "{}", (uint64_t)chunk);
|
||||
return fmt::format_to(ctx.out(), "{}", (uint64_t)chunk);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -460,7 +460,7 @@ template <>
|
||||
struct formatter<hf3fs::meta::VersionedLength> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(hf3fs::meta::VersionedLength v, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "{}@{}", v.length, v.truncateVer);
|
||||
return fmt::format_to(ctx.out(), "{}@{}", v.length, v.truncateVer);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ struct formatter<hf3fs::flat::ChainRef> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::flat::ChainRef &ref, FormatContext &ctx) const {
|
||||
auto [id, v, i] = ref.decode();
|
||||
return format_to(ctx.out(), "ChainRef({}@{}-{})", id.toUnderType(), v.toUnderType(), i);
|
||||
return fmt::format_to(ctx.out(), "ChainRef({}@{}-{})", id.toUnderType(), v.toUnderType(), i);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -744,7 +744,7 @@ template <>
|
||||
struct formatter<hf3fs::storage::ChunkId> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::storage::ChunkId &chunkId, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "ChunkId({})", chunkId.describe());
|
||||
return fmt::format_to(ctx.out(), "ChunkId({})", chunkId.describe());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -753,13 +753,13 @@ struct formatter<hf3fs::storage::ChunkIdRange> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::storage::ChunkIdRange &range, FormatContext &ctx) const {
|
||||
if (range.maxNumChunkIdsToProcess == 1) {
|
||||
return format_to(ctx.out(), "{}", range.begin);
|
||||
return fmt::format_to(ctx.out(), "{}", range.begin);
|
||||
} else {
|
||||
return format_to(ctx.out(),
|
||||
"ChunkIdRange[{}, {}){{{}}}",
|
||||
range.begin.describe(),
|
||||
range.end.describe(),
|
||||
range.maxNumChunkIdsToProcess);
|
||||
return fmt::format_to(ctx.out(),
|
||||
"ChunkIdRange[{}, {}){{{}}}",
|
||||
range.begin.describe(),
|
||||
range.end.describe(),
|
||||
range.maxNumChunkIdsToProcess);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -768,7 +768,7 @@ template <>
|
||||
struct formatter<hf3fs::storage::ChecksumInfo> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::storage::ChecksumInfo &checksum, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "{}#{:08X}", magic_enum::enum_name(checksum.type), ~checksum.value);
|
||||
return fmt::format_to(ctx.out(), "{}#{:08X}", magic_enum::enum_name(checksum.type), ~checksum.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -776,13 +776,13 @@ template <>
|
||||
struct formatter<hf3fs::storage::IOResult> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::storage::IOResult &result, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(),
|
||||
"length{{{}}} version{{{}/{}}} checksum{{{}}} {{{}}}",
|
||||
result.lengthInfo,
|
||||
result.updateVer,
|
||||
result.commitVer,
|
||||
result.checksum,
|
||||
result.commitChainVer);
|
||||
return fmt::format_to(ctx.out(),
|
||||
"length{{{}}} version{{{}/{}}} checksum{{{}}} {{{}}}",
|
||||
result.lengthInfo,
|
||||
result.updateVer,
|
||||
result.commitVer,
|
||||
result.checksum,
|
||||
result.commitChainVer);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -790,7 +790,7 @@ template <>
|
||||
struct formatter<hf3fs::storage::UpdateChannel> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::storage::UpdateChannel &channel, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "@{}#{}", channel.id, channel.seqnum);
|
||||
return fmt::format_to(ctx.out(), "@{}#{}", channel.id, channel.seqnum);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -798,7 +798,7 @@ template <>
|
||||
struct formatter<hf3fs::storage::MessageTag> : formatter<std::string_view> {
|
||||
template <typename FormatContext>
|
||||
auto format(const hf3fs::storage::MessageTag &tag, FormatContext &ctx) const {
|
||||
return format_to(ctx.out(), "@{}#{}:{}", tag.clientId, tag.requestId, tag.channel);
|
||||
return fmt::format_to(ctx.out(), "@{}#{}:{}", tag.clientId, tag.requestId, tag.channel);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user