12#include <userver/formats/json_fwd.hpp>
13#include <userver/formats/parse/common.hpp>
14#include <userver/formats/parse/common_containers.hpp>
15#include <userver/formats/yaml/value.hpp>
17#include <userver/yaml_config/iterator.hpp>
19USERVER_NAMESPACE_BEGIN
79 YamlConfig() =
default;
155 template <
typename T>
161 template <
typename T,
typename First,
typename... Rest>
162 auto As(First&& default_arg, Rest&&... more_default_args)
const;
167 template <
typename T>
185 const_iterator
end()
const;
188 formats::
yaml::Value yaml_;
189 formats::
yaml::Value config_vars_;
196 friend std::string Parse(
const YamlConfig& value,
197 formats::
parse::
To<std::string>);
205 "There is no `Parse(const yaml_config::YamlConfig&, "
206 "formats::parse::To<T>)`"
207 "in namespace of `T` or `formats::parse`. "
208 "Probably you forgot to include the "
209 "<userver/formats/parse/common_containers.hpp> or you "
210 "have not provided a `Parse` function overload.");
212 return Parse(*
this, formats::
parse::
To<T>{});
225template <
typename T,
typename First,
typename... Rest>
226auto YamlConfig::
As(First&& default_arg, Rest&&... more_default_args)
const {
230 return decltype(As<T>())(std::forward<First>(default_arg),
231 std::forward<Rest>(more_default_args)...);
238 return IsMissing() ?
decltype(As<T>())() : As<T>();
246using formats::
common::Items;
257 formats::
parse::
To<std::chrono::milliseconds>);