MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ProtoMessageCopy

Function ProtoMessageCopy

common/values/struct_value_builder.cc:81–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81absl::StatusOr<absl::optional<ErrorValue>> ProtoMessageCopy(
82 google::protobuf::Message* absl_nonnull to_message,
83 const google::protobuf::Descriptor* absl_nonnull to_descriptor,
84 const google::protobuf::Message* absl_nonnull from_message) {
85 CEL_ASSIGN_OR_RETURN(const auto* from_descriptor,
86 GetDescriptor(*from_message));
87 if (to_descriptor == from_descriptor) {
88 // Same.
89 to_message->CopyFrom(*from_message);
90 return absl::nullopt;
91 }
92 if (to_descriptor->full_name() == from_descriptor->full_name()) {
93 // Same type, different descriptors.
94 return ProtoMessageCopyUsingSerialization(to_message, from_message);
95 }
96 return TypeConversionError(from_descriptor->full_name(),
97 to_descriptor->full_name());
98}
99
100absl::StatusOr<absl::optional<ErrorValue>> ProtoMessageFromValueImpl(
101 const Value& value, const google::protobuf::DescriptorPool* absl_nonnull pool,

Callers 1

Calls 3

TypeConversionErrorFunction · 0.85
CopyFromMethod · 0.80

Tested by

no test coverage detected