userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
meta.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/dump/meta.hpp
4
/// @brief Provides dump::kIsDumpable and includes userver/dump/fwd.hpp
5
6
#
include
<
concepts
>
7
#
include
<
type_traits
>
8
9
#
include
<
userver
/
dump
/
fwd
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
dump
{
14
15
/// Check if `writer.Write(T)` is available
16
template
<
typename
T>
17
// NOLINTNEXTLINE(readability-identifier-naming)
18
concept
IsWritable
=
requires
(Writer& writer,
const
T& value) {
19
{
20
Write(writer, value)
21
} -> std::same_as<
void
>;
22
};
23
24
/// Check if `reader.Read<T>()` is available
25
template
<
typename
T>
26
// NOLINTNEXTLINE(readability-identifier-naming)
27
concept
IsReadable
=
requires
(
Reader
& reader) {
28
{
29
Read(reader,
To
<T>{})
30
} -> std::same_as<std::remove_const_t<T>>;
31
};
32
33
/// Check if `T` is both writable and readable
34
template
<
typename
T>
35
// NOLINTNEXTLINE(readability-identifier-naming)
36
concept
IsDumpable
=
IsWritable
<T> &&
IsReadable
<T>;
37
38
template
<
typename
T>
39
constexpr
bool
CheckDumpable() {
40
static_assert
(
41
IsDumpable
<T>,
42
"Type is not dumpable. Probably you forgot to include "
43
"<userver/dump/common.hpp>, <userver/dump/common_containers.hpp> or "
44
"other headers with Read and Write declarations"
45
);
46
47
return
true
;
48
}
49
50
/// @deprecated Use @ref dump::IsWritable instead.
51
template
<
typename
T>
52
// NOLINTNEXTLINE(readability-identifier-naming)
53
concept
kIsWritable
=
IsWritable
<T>;
54
55
/// @deprecated Use @ref dump::IsReadable instead.
56
template
<
typename
T>
57
// NOLINTNEXTLINE(readability-identifier-naming)
58
concept
kIsReadable
=
IsReadable
<T>;
59
60
/// @deprecated Use @ref dump::IsDumpable instead.
61
template
<
typename
T>
62
// NOLINTNEXTLINE(readability-identifier-naming)
63
concept
kIsDumpable
=
IsDumpable
<T>;
64
65
}
// namespace dump
66
67
USERVER_NAMESPACE_END
userver
dump
meta.hpp
Generated on
for userver by
Doxygen
1.17.0