From 01ec3fab1f8293721830c8f4b73db31ad71b789a Mon Sep 17 00:00:00 2001 From: Jakob Buchgraber Date: Wed, 29 May 2024 03:05:19 -0700 Subject: [PATCH] Accept MessageLite type instead of the Message type in SerializeMsg 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 --- rust/cpp_kernel/cpp_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/cpp_kernel/cpp_api.h b/rust/cpp_kernel/cpp_api.h index 3d82472d54e6..e165e8b838cf 100644 --- a/rust/cpp_kernel/cpp_api.h +++ b/rust/cpp_kernel/cpp_api.h @@ -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) {