blob: 412b4971288c6a1ca8ab173d1c75c2df57090307 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef ERROR_ATTRIBUTE_INL_H_
#error "Direct inclusion of this file is not allowed, include error_attribute.h"
// For the sake of sane code completion.
#include "error_attribute.h"
#endif
#include "text_yson.h"
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
namespace NAttributeValueConversionImpl {
template <CPrimitiveConvertible T>
std::string TagInvoke(TTagInvokeTag<ToErrorAttributeValue>, const T& value)
{
if constexpr (std::constructible_from<TStringBuf, const T&>) {
return NDetail::ConvertToTextYsonString(TStringBuf(value));
} else {
return NDetail::ConvertToTextYsonString(value);
}
}
////////////////////////////////////////////////////////////////////////////////
template <CPrimitiveConvertible T>
T TagInvoke(TFrom<T>, TStringBuf value)
{
YT_VERIFY(!NDetail::IsBinaryYson(value));
return NDetail::ConvertFromTextYsonString<T>(value);
}
} // namespace NAttributeValueConversionImpl
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|