Skip to content

Commit

Permalink
Accept MessageLite type instead of the Message type in SerializeMsg
Browse files Browse the repository at this point in the history
We don't need any of the functionality provided by Message. This is a step towards building Rust protos with C++ lite.

PiperOrigin-RevId: 638216968
  • Loading branch information
buchgr authored and copybara-github committed May 29, 2024
1 parent 05e5107 commit 01ec3fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rust/cpp_kernel/cpp_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern "C" struct SerializedData {
// This function is defined in `rust_alloc_for_cpp_api.rs`.
extern "C" void* __pb_rust_alloc(size_t size, size_t align);

inline SerializedData SerializeMsg(const google::protobuf::Message* msg) {
inline SerializedData SerializeMsg(const google::protobuf::MessageLite* msg) {
size_t len = msg->ByteSizeLong();
void* bytes = __pb_rust_alloc(len, alignof(char));
if (bytes == nullptr) {
Expand Down

0 comments on commit 01ec3fa

Please sign in to comment.