Files
stvpn/works/protopart/message_test.cpp
T
2026-04-23 14:53:39 +02:00

27 lines
564 B
C++

#include <expected>
#include <string>
#include <cstring>
#include <iostream>
#include <format>
#include <hello.pb.h>
int main(int argc, char** argv) {
control::Hello msg;
msg.set_id(1);
msg.set_name("bare");
auto meta = msg.mutable_meta();
meta->set_rpcname("getHello");
std::string buffer;
msg.SerializeToString(&buffer);
control::Header newmsg;
newmsg.ParsePartialFromString(buffer);
auto newmeta = newmsg.meta();
std::cout << std::format("{}\n", meta->rpcname());
}