lib/fmt/ExceptionFormatter: un-inline to reduce header dependencies

This commit is contained in:
Max Kellermann 2024-07-02 09:56:31 +02:00 committed by Max Kellermann
parent 3f638eeed6
commit 175103e8d4
3 changed files with 17 additions and 10 deletions

View File

@ -0,0 +1,12 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#include "ExceptionFormatter.hxx"
#include "util/Exception.hxx"
auto
fmt::formatter<std::exception_ptr>::format(std::exception_ptr e, format_context &ctx) const
-> format_context::iterator
{
return formatter<string_view>::format(GetFullMessage(e), ctx);
}

View File

@ -1,20 +1,14 @@
// SPDX-License-Identifier: BSD-2-Clause
// author: Max Kellermann <max.kellermann@gmail.com>
#ifndef EXCEPTION_FORMATTER_HXX
#define EXCEPTION_FORMATTER_HXX
#include "util/Exception.hxx"
#pragma once
#include <fmt/format.h>
#include <exception>
template<>
struct fmt::formatter<std::exception_ptr> : formatter<string_view>
{
template<typename FormatContext>
auto format(std::exception_ptr e, FormatContext &ctx) const {
return formatter<string_view>::format(GetFullMessage(e), ctx);
}
auto format(std::exception_ptr e, format_context &ctx) const -> format_context::iterator;
};
#endif

View File

@ -10,6 +10,7 @@ endif
fmt = static_library(
'fmt',
'ExceptionFormatter.cxx',
'RuntimeError.cxx',
'SocketAddressFormatter.cxx',
'SystemError.cxx',