12#include <userver/compiler/select.hpp>
13#include <userver/formats/bson/document.hpp>
14#include <userver/formats/bson/value.hpp>
15#include <userver/formats/json_fwd.hpp>
16#include <userver/logging/log_helper_fwd.hpp>
17#include <userver/utils/fast_pimpl.hpp>
18#include <userver/utils/fmt_compat.hpp>
20USERVER_NAMESPACE_BEGIN
80 explicit JsonString(impl::JsonStringImpl&&);
85 operator std::string()
const {
return ToString(); }
93 const char* Data()
const;
100 static constexpr std::size_t kAlignment =
alignof(
void*);
101 utils::FastPimpl<impl::JsonStringImpl, kSize, kAlignment, utils::kStrictMatch> impl_;
104std::ostream& operator<<(std::ostream&,
const JsonString&);
116struct fmt::formatter<USERVER_NAMESPACE::formats::bson::JsonString> :
public fmt::formatter<std::string_view> {
117 template <
typename FormatContext>
118 auto format(
const USERVER_NAMESPACE::formats::bson::JsonString& json, FormatContext& ctx)
USERVER_FMT_CONST {
119 return fmt::formatter<std::string_view>::format(json.GetView(), ctx);
125struct fmt::formatter<USERVER_NAMESPACE::formats::bson::Document> :
public fmt::formatter<std::string_view> {
126 template <
typename FormatContext>
127 auto format(
const USERVER_NAMESPACE::formats::bson::Document& bson, FormatContext& ctx)
USERVER_FMT_CONST {
128 return fmt::formatter<std::string_view>::format(
129 USERVER_NAMESPACE::formats::bson::ToRelaxedJsonString(bson).GetView(), ctx