Currently, RProtoBuf
exposes the DebugString
through toString()
and as.character()
methods, but there is no way to convert to the TextFormat
representation.
Until now, this hasn't mattered much as the two formats are basically identical, but we recently started emphasizing the difference between the two as they're expected to diverge more going forward.
Here's the doc string that will be attached to DebugString()
once GitHub syncs with our internal sources in message.h
:
// Generates a human-readable form of this message for debugging purposes. // Note that the format and content of a debug string is not guaranteed, may // change without notice, and should not be depended on. Code that does // anything except display a string to assist in debugging should use // TextFormat instead. std::string DebugString() const;
Currently, we have an internal patch creating a new toTextFormat()
method to expose TextFormat()
which basically wraps the corresponding C++ method
// in wrapper_Message.cpp /** * Return the TextFormat of message * * @param xp external pointer to the Message */ RPB_FUNCTION_1(std::string, METHOD(print_text_format), Rcpp::XPtr<GPB::Message> message) { std::string message_text; GPB::TextFormat::PrintToString(*message, &message_text); return message_text; }
However I am wondering whether it makes sense to switch things around so that toString()
returns the TextFormat
representation and we add a toDebugString()
method to expose that, if necessary.
Happy to file the PR whichever way.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4