#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Any {
pub type_url: ::buffa::alloc::string::String,
#[cfg_attr(
feature = "arbitrary",
arbitrary(with = ::buffa::__private::arbitrary_proto_bytes)
)]
pub value: ::buffa::bytes::Bytes,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Any {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Any")
.field("type_url", &self.type_url)
.field("value", &self.value)
.finish()
}
}
impl Any {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Any";
}
::buffa::impl_default_instance!(Any);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Any {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.type_url),
2u32 => ::buffa_descriptor::reflect::ValueRef::Bytes(&self.value[..]),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.type_url.is_empty(),
2u32 => !self.value.is_empty(),
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for Any {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Any {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for Any {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Any {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Any";
const FULL_NAME: &'static str = "google.protobuf.Any";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Any";
}
impl ::buffa::Message for Any {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.type_url.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.type_url) as u64;
}
if !self.value.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.type_url.is_empty() {
::buffa::types::put_string_field(1u32, &self.type_url, buf);
}
if !self.value.is_empty() {
::buffa::types::put_shared_bytes_field(2u32, &self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.type_url, buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
self.value = ::buffa::types::decode_bytes_to_bytes(buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.type_url.clear();
self.value = ::core::default::Default::default();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Any {
const PROTO_FQN: &'static str = "google.protobuf.Any";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
#[doc(hidden)]
pub const __ANY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Any",
text_encode: ::buffa::type_registry::any_encode_text::<Any>,
text_merge: ::buffa::type_registry::any_merge_text::<Any>,
};