userver
C++ Async Framework
Loading...
Searching...
No Matches
ref.hpp
1
#
pragma
once
2
3
#
include
<
userver
/
formats
/
common
/
meta
.
hpp
>
4
#
include
<
userver
/
formats
/
json
/
value
.
hpp
>
5
#
include
<
userver
/
utils
/
box
.
hpp
>
6
7
USERVER_NAMESPACE_BEGIN
8
9
namespace
chaotic {
10
11
template
<
typename
T>
12
struct
Ref
{
13
const
utils::Box<formats::common::ParseType<formats::json::Value, T>>& value;
14
};
15
16
template
<
typename
Value,
typename
T>
17
utils::Box<formats::common::ParseType<Value, T>> Parse(
const
Value& value, formats::parse::To<Ref<T>>) {
18
auto
result = value.
template
As<T>();
19
return
result;
20
}
21
22
template
<
typename
Value,
typename
T>
23
Value Serialize(
const
Ref
<T>& ps,
formats
::
serialize
::
To
<Value>) {
24
return
typename
Value::Builder{T{*ps.value}}.ExtractValue();
25
}
26
27
}
// namespace chaotic
28
29
USERVER_NAMESPACE_END
userver
chaotic
ref.hpp
Generated on Wed Dec 4 2024 18:43:18 for userver by
Doxygen
1.10.0