summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/yson_string/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp/yt/yson_string/string.h')
-rw-r--r--library/cpp/yt/yson_string/string.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h
index 45cec2fb8c1..c93240ebade 100644
--- a/library/cpp/yt/yson_string/string.h
+++ b/library/cpp/yt/yson_string/string.h
@@ -67,7 +67,7 @@ class TYsonString
{
public:
//! Constructs a null instance.
- TYsonString();
+ TYsonString() = default;
//! Constructs an instance from TYsonStringBuf.
//! Copies the data into a ref-counted payload.
@@ -85,6 +85,18 @@ public:
const TString& data,
EYsonType type = EYsonType::Node);
+ //! Constructs an instance from TCowString.
+ //! Zero-copy: retains the reference to TCowString in payload.
+ explicit TYsonString(
+ TCowString data,
+ EYsonType type = EYsonType::Node);
+
+ //! Constructs an instance from std::string.
+ //! Moves #data into a ref-counted payload.
+ explicit TYsonString(
+ std::string data,
+ EYsonType type = EYsonType::Node);
+
//! Constructs an instance from TSharedRef.
//! Zero-copy; retains the reference to TSharedRef holder in payload.
explicit TYsonString(
@@ -121,9 +133,9 @@ private:
std::variant<TNullPayload, TSharedRangeHolderPtr, TCowString> Payload_;
- const char* Begin_;
- ui64 Size_ : 56;
- EYsonType Type_ : 8;
+ const char* Begin_ = nullptr;
+ ui64 Size_ : 56 = 0;
+ EYsonType Type_ : 8 = EYsonType::Node;
};
////////////////////////////////////////////////////////////////////////////////