81#include <reloco/any.hpp>
82#include <reloco/error.hpp>
83#include <reloco/flat_hash_map.hpp>
84#include <reloco/flat_hash_set.hpp>
85#include <reloco/rc.hpp>
104template <>
struct Debug<any> {
105 static void format(
const any &val,
const sink &out)
noexcept {
118template <>
struct Debug<error> {
131template <
typename T,
typename E>
struct Debug<expected<T, E>> {
132 static void format(
const expected<T, E> &val,
const sink &out)
noexcept {
133 if (val.has_value()) {
149template <
typename E>
struct Debug<expected<void, E>> {
150 static void format(
const expected<void, E> &val,
const sink &out)
noexcept {
151 if (val.has_value()) {
168template <
typename T>
struct Debug<rc<T>> {
169 static void format(
const rc<T> &val,
const sink &out)
noexcept {
187template <
typename T>
struct Debug<weak_rc<T>> {
188 static void format(
const weak_rc<T> &val,
const sink &out)
noexcept {
190 auto locked = val.lock();
191 if (!locked.has_value()) {
192 out.write(
"(expired)");
208template <
typename T,
typename Hash,
typename KeyEqual>
struct Debug<flat_hash_set<T, Hash, KeyEqual>> {
209 static void format(
const flat_hash_set<T, Hash, KeyEqual> &val,
const sink &out)
noexcept {
210 microfmt::format_to(out,
"flat_hash_set(size: {}, capacity: {}, load_factor_permille: {}) [", val.size(),
211 val.capacity(), val.load_factor_permille());
212 bool is_first =
true;
213 for (
const auto &elem : val) {
228template <
typename Key,
typename Mapped,
typename Hash,
typename KeyEqual>
229struct Debug<flat_hash_map<Key, Mapped, Hash, KeyEqual>> {
230 static void format(
const flat_hash_map<Key, Mapped, Hash, KeyEqual> &val,
const sink &out)
noexcept {
231 microfmt::format_to(out,
"flat_hash_map(size: {}, capacity: {}, load_factor_permille: {}) {{", val.size(),
232 val.capacity(), val.load_factor_permille());
233 bool is_first =
true;
234 for (
const auto &entry : val) {
Core formatting primitives, sinks, and customization point.
RELOCO_CONSTEXPR20 void format_to(const sink &out, microfmt::string_view fmt, const Args &...args) noexcept
Definition microfmt.hpp:1766
constexpr auto as_debug(const T &value RELOCO_LIFETIMEBOUND) noexcept
Wraps value so it always renders through reloco's Debug<T> customization point when one exists,...
Definition microfmt.hpp:1702
Definition debug_float.hpp:36
Single re-export of every `reloco` type and annotation microfmt builds on.
static void format(const any &val, const sink &out) noexcept
Definition reloco_debug.hpp:105
static void format(const error &val, const sink &out) noexcept
Definition reloco_debug.hpp:119
static void format(const expected< T, E > &val, const sink &out) noexcept
Definition reloco_debug.hpp:132
static void format(const expected< void, E > &val, const sink &out) noexcept
Definition reloco_debug.hpp:150
static void format(const flat_hash_map< Key, Mapped, Hash, KeyEqual > &val, const sink &out) noexcept
Definition reloco_debug.hpp:230
static void format(const flat_hash_set< T, Hash, KeyEqual > &val, const sink &out) noexcept
Definition reloco_debug.hpp:209
static void format(const rc< T > &val, const sink &out) noexcept
Definition reloco_debug.hpp:169
static void format(const weak_rc< T > &val, const sink &out) noexcept
Definition reloco_debug.hpp:188