lib/fmt/SocketAddressFormatter: switch to the new net/FormatAddress library
This commit is contained in:
parent
d3ef4ab234
commit
8790f2469c
|
@ -2,11 +2,19 @@
|
|||
// author: Max Kellermann <max.kellermann@gmail.com>
|
||||
|
||||
#include "SocketAddressFormatter.hxx"
|
||||
#include "net/ToString.hxx"
|
||||
#include "net/FormatAddress.hxx"
|
||||
|
||||
auto
|
||||
fmt::formatter<SocketAddress>::format(SocketAddress address, format_context &ctx) const
|
||||
-> format_context::iterator
|
||||
{
|
||||
return formatter<string_view>::format(ToString(address), ctx);
|
||||
char buffer[256];
|
||||
std::string_view s;
|
||||
|
||||
if (ToString(std::span{buffer}, address))
|
||||
s = buffer;
|
||||
else
|
||||
s = "?";
|
||||
|
||||
return formatter<string_view>::format(s, ctx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue