mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
It is common to want to match only a subset of fields in large protobufs, and doing that in rust right now requires manually clearing out the fields in the `actual` message that we don't care about. This is a pain, and a worse experience when compared to C++. Like in C++, when doing partial matching, only fields set in the expected protobuf message are compared, while extra fields set only in the actual message are ignored. When using the C++ kernel we leverage `proto2::util::MessageDifferencer`, and for the UPB kernel we use the `kUpb_CompareOption_Partial` option. PiperOrigin-RevId: 964125682
16 lines
540 B
C
16 lines
540 B
C
#ifndef GOOGLE_PROTOBUF_RUST_CPP_KERNEL_COMPARE_H__
|
|
#define GOOGLE_PROTOBUF_RUST_CPP_KERNEL_COMPARE_H__
|
|
|
|
#include "google/protobuf/message_lite.h"
|
|
|
|
extern "C" {
|
|
|
|
bool proto2_rust_messagelite_equals(const google::protobuf::MessageLite* msg1,
|
|
const google::protobuf::MessageLite* msg2);
|
|
|
|
bool proto2_rust_messagelite_partially_equals(
|
|
const google::protobuf::MessageLite* actual, const google::protobuf::MessageLite* expected);
|
|
|
|
} // extern "C"
|
|
|
|
#endif // GOOGLE_PROTOBUF_RUST_CPP_KERNEL_COMPARE_H__
|