1#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
9#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
10#[repr(i32)]
11pub enum NullValue {
12 NULL_VALUE = 0i32,
14}
15impl NullValue {
16 #[allow(non_upper_case_globals)]
18 pub const NullValue: Self = Self::NULL_VALUE;
19}
20impl ::core::default::Default for NullValue {
21 fn default() -> Self {
22 Self::NULL_VALUE
23 }
24}
25impl ::buffa::Enumeration for NullValue {
26 fn from_i32(value: i32) -> ::core::option::Option<Self> {
27 match value {
28 0i32 => ::core::option::Option::Some(Self::NULL_VALUE),
29 _ => ::core::option::Option::None,
30 }
31 }
32 fn to_i32(&self) -> i32 {
33 *self as i32
34 }
35 fn proto_name(&self) -> &'static str {
36 match self {
37 Self::NULL_VALUE => "NULL_VALUE",
38 }
39 }
40 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
41 match name {
42 "NULL_VALUE" => ::core::option::Option::Some(Self::NULL_VALUE),
43 _ => ::core::option::Option::None,
44 }
45 }
46 fn values() -> &'static [Self] {
47 &[Self::NULL_VALUE]
48 }
49}
50#[derive(Clone, PartialEq, Default)]
59#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
60pub struct Struct {
61 pub fields: ::buffa::__private::HashMap<::buffa::alloc::string::String, Value>,
65 #[doc(hidden)]
66 pub __buffa_unknown_fields: ::buffa::UnknownFields,
67}
68impl ::core::fmt::Debug for Struct {
69 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
70 f.debug_struct("Struct").field("fields", &self.fields).finish()
71 }
72}
73impl Struct {
74 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Struct";
79}
80::buffa::impl_default_instance!(Struct);
81#[cfg(feature = "reflect")]
82const _: () = {
83 impl ::buffa_descriptor::reflect::ReflectMessage for Struct {
84 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
85 __buffa::reflect::descriptor_pool()
86 .message(Self::__buffa_reflect_message_index())
87 }
88 fn pool(
89 &self,
90 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
91 __buffa::reflect::descriptor_pool()
92 }
93 fn unknown_fields(&self) -> &::buffa::UnknownFields {
94 &self.__buffa_unknown_fields
95 }
96 fn get(
97 &self,
98 field: &::buffa_descriptor::FieldDescriptor,
99 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
100 #[allow(unused_imports)]
101 use ::buffa::Enumeration as _;
102 match field.number() {
103 1u32 => ::buffa_descriptor::reflect::ValueRef::Map(&self.fields),
104 _ => {
105 ::core::debug_assert!(
106 false,
107 "field number {} is not a member of this message's reflect get()",
108 field.number(),
109 );
110 ::buffa_descriptor::reflect::ValueRef::Bool(false)
111 }
112 }
113 }
114 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
115 match field.number() {
116 1u32 => !self.fields.is_empty(),
117 _ => false,
118 }
119 }
120 fn for_each_set(
121 &self,
122 f: &mut dyn ::core::ops::FnMut(
123 &::buffa_descriptor::FieldDescriptor,
124 ::buffa_descriptor::reflect::ValueRef<'_>,
125 ),
126 ) {
127 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
128 self,
129 );
130 for fd in md.fields() {
131 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
132 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
133 }
134 }
135 }
136 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
137 ::buffa_descriptor::reflect::DynamicMessage::from_message(
138 self,
139 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
140 Self::__buffa_reflect_message_index(),
141 )
142 }
143 }
144 impl ::buffa_descriptor::reflect::ReflectElement for Struct {
145 #[inline]
146 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
147 ::buffa_descriptor::reflect::ValueRef::Message(
148 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
149 )
150 }
151 }
152 impl Struct {
153 #[doc(hidden)]
156 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
157 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
158 *IDX
159 .get_or_init(|| {
160 __buffa::reflect::descriptor_pool()
161 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
162 .expect(
163 "generated message is registered in the embedded descriptor pool",
164 )
165 })
166 }
167 }
168 impl ::buffa_descriptor::reflect::Reflectable for Struct {
169 #[inline]
173 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
174 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
175 }
176 }
177};
178impl ::buffa::MessageName for Struct {
179 const PACKAGE: &'static str = "google.protobuf";
180 const NAME: &'static str = "Struct";
181 const FULL_NAME: &'static str = "google.protobuf.Struct";
182 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Struct";
183}
184impl ::buffa::Message for Struct {
185 #[allow(clippy::let_and_return)]
193 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
194 #[allow(unused_imports)]
195 use ::buffa::Enumeration as _;
196 let mut size = 0u64;
197 size
198 += ::buffa::map_codec::message_field_len::<
199 ::buffa::map_codec::Str,
200 _,
201 _,
202 >(&self.fields, 1u64, __cache);
203 size += self.__buffa_unknown_fields.encoded_len() as u64;
204 ::buffa::saturate_size(size)
205 }
206 fn write_to(
207 &self,
208 __cache: &mut ::buffa::SizeCache,
209 buf: &mut impl ::buffa::EncodeSink,
210 ) {
211 #[allow(unused_imports)]
212 use ::buffa::Enumeration as _;
213 ::buffa::map_codec::write_message_field::<
214 ::buffa::map_codec::Str,
215 _,
216 _,
217 >(&self.fields, 1u32, __cache, buf);
218 self.__buffa_unknown_fields.write_to(buf);
219 }
220 fn merge_field(
221 &mut self,
222 tag: ::buffa::encoding::Tag,
223 buf: &mut impl ::buffa::bytes::Buf,
224 ctx: ::buffa::DecodeContext<'_>,
225 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
226 #[allow(unused_imports)]
227 use ::buffa::bytes::Buf as _;
228 #[allow(unused_imports)]
229 use ::buffa::Enumeration as _;
230 match tag.field_number() {
231 1u32 => {
232 ::buffa::encoding::check_wire_type(
233 tag,
234 ::buffa::encoding::WireType::LengthDelimited,
235 )?;
236 ::buffa::map_codec::merge_entry::<
237 ::buffa::map_codec::Str,
238 ::buffa::map_codec::Msg<_>,
239 _,
240 >(&mut self.fields, buf, ctx)?;
241 }
242 _ => {
243 self.__buffa_unknown_fields
244 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
245 }
246 }
247 ::core::result::Result::Ok(())
248 }
249 fn clear(&mut self) {
250 self.fields.clear();
251 self.__buffa_unknown_fields.clear();
252 }
253}
254impl ::buffa::ExtensionSet for Struct {
255 const PROTO_FQN: &'static str = "google.protobuf.Struct";
256 fn unknown_fields(&self) -> &::buffa::UnknownFields {
257 &self.__buffa_unknown_fields
258 }
259 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
260 &mut self.__buffa_unknown_fields
261 }
262}
263impl ::buffa::text::TextFormat for Struct {
264 fn encode_text(
265 &self,
266 enc: &mut ::buffa::text::TextEncoder<'_>,
267 ) -> ::core::fmt::Result {
268 #[allow(unused_imports)]
269 use ::buffa::Enumeration as _;
270 for (__k, __v) in &self.fields {
271 enc.write_field_name("fields")?;
272 enc.write_map_entry(|enc| {
273 enc.write_field_name("key")?;
274 enc.write_string(__k)?;
275 enc.write_field_name("value")?;
276 enc.write_message(__v)?;
277 ::core::result::Result::Ok(())
278 })?;
279 }
280 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
281 ::core::result::Result::Ok(())
282 }
283 fn merge_text(
284 &mut self,
285 dec: &mut ::buffa::text::TextDecoder<'_>,
286 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
287 #[allow(unused_imports)]
288 use ::buffa::Enumeration as _;
289 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
290 match __name {
291 "fields" => {
292 let mut __pairs: ::buffa::alloc::vec::Vec<_> = ::buffa::alloc::vec::Vec::new();
293 dec.read_repeated_into(
294 &mut __pairs,
295 |__d| {
296 let mut __k = ::core::option::Option::None;
297 let mut __v = ::core::option::Option::None;
298 __d.merge_map_entry(|__d| {
299 while let ::core::option::Option::Some(__n) = __d
300 .read_field_name()?
301 {
302 match __n {
303 "key" => {
304 __k = ::core::option::Option::Some(
305 __d.read_string()?.into_owned(),
306 );
307 }
308 "value" => {
309 __v = ::core::option::Option::Some({
310 let mut __m = ::core::default::Default::default();
311 __d.merge_message(&mut __m)?;
312 __m
313 });
314 }
315 _ => __d.skip_value()?,
316 }
317 }
318 ::core::result::Result::Ok(())
319 })?;
320 ::core::result::Result::Ok((
321 __k.unwrap_or_default(),
322 __v.unwrap_or_default(),
323 ))
324 },
325 )?;
326 for (__k, __v) in __pairs {
327 self.fields.insert(__k, __v);
328 }
329 }
330 _ => dec.skip_value()?,
331 }
332 }
333 ::core::result::Result::Ok(())
334 }
335}
336#[doc(hidden)]
337pub const __STRUCT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
338 type_url: "type.googleapis.com/google.protobuf.Struct",
339 text_encode: ::buffa::type_registry::any_encode_text::<Struct>,
340 text_merge: ::buffa::type_registry::any_merge_text::<Struct>,
341};
342#[derive(Clone, PartialEq, Default)]
349#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
350pub struct Value {
351 pub kind: ::core::option::Option<__buffa::oneof::value::Kind>,
352 #[doc(hidden)]
353 pub __buffa_unknown_fields: ::buffa::UnknownFields,
354}
355impl ::core::fmt::Debug for Value {
356 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
357 f.debug_struct("Value").field("kind", &self.kind).finish()
358 }
359}
360impl Value {
361 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Value";
366}
367::buffa::impl_default_instance!(Value);
368#[cfg(feature = "reflect")]
369const _: () = {
370 impl ::buffa_descriptor::reflect::ReflectMessage for Value {
371 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
372 __buffa::reflect::descriptor_pool()
373 .message(Self::__buffa_reflect_message_index())
374 }
375 fn pool(
376 &self,
377 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
378 __buffa::reflect::descriptor_pool()
379 }
380 fn unknown_fields(&self) -> &::buffa::UnknownFields {
381 &self.__buffa_unknown_fields
382 }
383 fn get(
384 &self,
385 field: &::buffa_descriptor::FieldDescriptor,
386 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
387 #[allow(unused_imports)]
388 use ::buffa::Enumeration as _;
389 match field.number() {
390 1u32 => {
391 match &self.kind {
392 ::core::option::Option::Some(
393 __buffa::oneof::value::Kind::NullValue(v),
394 ) => {
395 ::buffa_descriptor::reflect::ValueRef::EnumNumber(v.to_i32())
396 }
397 _ => ::buffa_descriptor::reflect::ValueRef::EnumNumber(0),
398 }
399 }
400 2u32 => {
401 match &self.kind {
402 ::core::option::Option::Some(
403 __buffa::oneof::value::Kind::NumberValue(v),
404 ) => ::buffa_descriptor::reflect::ValueRef::F64(*v),
405 _ => ::buffa_descriptor::reflect::ValueRef::F64(0.0),
406 }
407 }
408 3u32 => {
409 match &self.kind {
410 ::core::option::Option::Some(
411 __buffa::oneof::value::Kind::StringValue(v),
412 ) => ::buffa_descriptor::reflect::ValueRef::String(v),
413 _ => ::buffa_descriptor::reflect::ValueRef::String(""),
414 }
415 }
416 4u32 => {
417 match &self.kind {
418 ::core::option::Option::Some(
419 __buffa::oneof::value::Kind::BoolValue(v),
420 ) => ::buffa_descriptor::reflect::ValueRef::Bool(*v),
421 _ => ::buffa_descriptor::reflect::ValueRef::Bool(false),
422 }
423 }
424 5u32 => {
425 match &self.kind {
426 ::core::option::Option::Some(
427 __buffa::oneof::value::Kind::StructValue(v),
428 ) => {
429 ::buffa_descriptor::reflect::ValueRef::Message(
430 ::buffa_descriptor::reflect::Reflectable::reflect(&**v),
431 )
432 }
433 _ => {
434 ::buffa_descriptor::reflect::ValueRef::Message(
435 ::buffa_descriptor::reflect::Reflectable::reflect(
436 <Struct as ::buffa::DefaultInstance>::default_instance(),
437 ),
438 )
439 }
440 }
441 }
442 6u32 => {
443 match &self.kind {
444 ::core::option::Option::Some(
445 __buffa::oneof::value::Kind::ListValue(v),
446 ) => {
447 ::buffa_descriptor::reflect::ValueRef::Message(
448 ::buffa_descriptor::reflect::Reflectable::reflect(&**v),
449 )
450 }
451 _ => {
452 ::buffa_descriptor::reflect::ValueRef::Message(
453 ::buffa_descriptor::reflect::Reflectable::reflect(
454 <ListValue as ::buffa::DefaultInstance>::default_instance(),
455 ),
456 )
457 }
458 }
459 }
460 _ => {
461 ::core::debug_assert!(
462 false,
463 "field number {} is not a member of this message's reflect get()",
464 field.number(),
465 );
466 ::buffa_descriptor::reflect::ValueRef::Bool(false)
467 }
468 }
469 }
470 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
471 match field.number() {
472 1u32 => {
473 ::core::matches!(
474 & self.kind,
475 ::core::option::Option::Some(__buffa::oneof::value::Kind::NullValue(_))
476 )
477 }
478 2u32 => {
479 ::core::matches!(
480 & self.kind,
481 ::core::option::Option::Some(__buffa::oneof::value::Kind::NumberValue(_))
482 )
483 }
484 3u32 => {
485 ::core::matches!(
486 & self.kind,
487 ::core::option::Option::Some(__buffa::oneof::value::Kind::StringValue(_))
488 )
489 }
490 4u32 => {
491 ::core::matches!(
492 & self.kind,
493 ::core::option::Option::Some(__buffa::oneof::value::Kind::BoolValue(_))
494 )
495 }
496 5u32 => {
497 ::core::matches!(
498 & self.kind,
499 ::core::option::Option::Some(__buffa::oneof::value::Kind::StructValue(_))
500 )
501 }
502 6u32 => {
503 ::core::matches!(
504 & self.kind,
505 ::core::option::Option::Some(__buffa::oneof::value::Kind::ListValue(_))
506 )
507 }
508 _ => false,
509 }
510 }
511 fn for_each_set(
512 &self,
513 f: &mut dyn ::core::ops::FnMut(
514 &::buffa_descriptor::FieldDescriptor,
515 ::buffa_descriptor::reflect::ValueRef<'_>,
516 ),
517 ) {
518 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
519 self,
520 );
521 for fd in md.fields() {
522 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
523 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
524 }
525 }
526 }
527 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
528 ::buffa_descriptor::reflect::DynamicMessage::from_message(
529 self,
530 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
531 Self::__buffa_reflect_message_index(),
532 )
533 }
534 }
535 impl ::buffa_descriptor::reflect::ReflectElement for Value {
536 #[inline]
537 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
538 ::buffa_descriptor::reflect::ValueRef::Message(
539 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
540 )
541 }
542 }
543 impl Value {
544 #[doc(hidden)]
547 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
548 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
549 *IDX
550 .get_or_init(|| {
551 __buffa::reflect::descriptor_pool()
552 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
553 .expect(
554 "generated message is registered in the embedded descriptor pool",
555 )
556 })
557 }
558 }
559 impl ::buffa_descriptor::reflect::Reflectable for Value {
560 #[inline]
564 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
565 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
566 }
567 }
568};
569impl ::buffa::MessageName for Value {
570 const PACKAGE: &'static str = "google.protobuf";
571 const NAME: &'static str = "Value";
572 const FULL_NAME: &'static str = "google.protobuf.Value";
573 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Value";
574}
575impl ::buffa::Message for Value {
576 #[allow(clippy::let_and_return)]
584 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
585 #[allow(unused_imports)]
586 use ::buffa::Enumeration as _;
587 let mut size = 0u64;
588 if let ::core::option::Option::Some(ref v) = self.kind {
589 match v {
590 __buffa::oneof::value::Kind::NullValue(x) => {
591 size += 1u64 + ::buffa::types::int32_encoded_len(x.to_i32()) as u64;
592 }
593 __buffa::oneof::value::Kind::NumberValue(_x) => {
594 size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64;
595 }
596 __buffa::oneof::value::Kind::StringValue(x) => {
597 size += 1u64 + ::buffa::types::string_encoded_len(x) as u64;
598 }
599 __buffa::oneof::value::Kind::BoolValue(_x) => {
600 size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
601 }
602 __buffa::oneof::value::Kind::StructValue(x) => {
603 let __slot = __cache.reserve();
604 let inner = x.compute_size(__cache);
605 __cache.set(__slot, inner);
606 size
607 += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64
608 + inner as u64;
609 }
610 __buffa::oneof::value::Kind::ListValue(x) => {
611 let __slot = __cache.reserve();
612 let inner = x.compute_size(__cache);
613 __cache.set(__slot, inner);
614 size
615 += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64
616 + inner as u64;
617 }
618 }
619 }
620 size += self.__buffa_unknown_fields.encoded_len() as u64;
621 ::buffa::saturate_size(size)
622 }
623 fn write_to(
624 &self,
625 __cache: &mut ::buffa::SizeCache,
626 buf: &mut impl ::buffa::EncodeSink,
627 ) {
628 #[allow(unused_imports)]
629 use ::buffa::Enumeration as _;
630 if let ::core::option::Option::Some(ref v) = self.kind {
631 match v {
632 __buffa::oneof::value::Kind::NullValue(x) => {
633 ::buffa::types::put_int32_field(1u32, x.to_i32(), buf);
634 }
635 __buffa::oneof::value::Kind::NumberValue(x) => {
636 ::buffa::types::put_double_field(2u32, *x, buf);
637 }
638 __buffa::oneof::value::Kind::StringValue(x) => {
639 ::buffa::types::put_string_field(3u32, x, buf);
640 }
641 __buffa::oneof::value::Kind::BoolValue(x) => {
642 ::buffa::types::put_bool_field(4u32, *x, buf);
643 }
644 __buffa::oneof::value::Kind::StructValue(x) => {
645 ::buffa::types::put_len_delimited_header(
646 5u32,
647 u64::from(__cache.consume_next()),
648 buf,
649 );
650 x.write_to(__cache, buf);
651 }
652 __buffa::oneof::value::Kind::ListValue(x) => {
653 ::buffa::types::put_len_delimited_header(
654 6u32,
655 u64::from(__cache.consume_next()),
656 buf,
657 );
658 x.write_to(__cache, buf);
659 }
660 }
661 }
662 self.__buffa_unknown_fields.write_to(buf);
663 }
664 fn merge_field(
665 &mut self,
666 tag: ::buffa::encoding::Tag,
667 buf: &mut impl ::buffa::bytes::Buf,
668 ctx: ::buffa::DecodeContext<'_>,
669 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
670 #[allow(unused_imports)]
671 use ::buffa::bytes::Buf as _;
672 #[allow(unused_imports)]
673 use ::buffa::Enumeration as _;
674 match tag.field_number() {
675 1u32 => {
676 ::buffa::encoding::check_wire_type(
677 tag,
678 ::buffa::encoding::WireType::Varint,
679 )?;
680 self.kind = ::core::option::Option::Some(
681 __buffa::oneof::value::Kind::NullValue(
682 ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
683 ),
684 );
685 }
686 2u32 => {
687 ::buffa::encoding::check_wire_type(
688 tag,
689 ::buffa::encoding::WireType::Fixed64,
690 )?;
691 self.kind = ::core::option::Option::Some(
692 __buffa::oneof::value::Kind::NumberValue(
693 ::buffa::types::decode_double(buf)?,
694 ),
695 );
696 }
697 3u32 => {
698 ::buffa::encoding::check_wire_type(
699 tag,
700 ::buffa::encoding::WireType::LengthDelimited,
701 )?;
702 self.kind = ::core::option::Option::Some(
703 __buffa::oneof::value::Kind::StringValue(
704 ::buffa::types::decode_string(buf)?,
705 ),
706 );
707 }
708 4u32 => {
709 ::buffa::encoding::check_wire_type(
710 tag,
711 ::buffa::encoding::WireType::Varint,
712 )?;
713 self.kind = ::core::option::Option::Some(
714 __buffa::oneof::value::Kind::BoolValue(
715 ::buffa::types::decode_bool(buf)?,
716 ),
717 );
718 }
719 5u32 => {
720 ::buffa::encoding::check_wire_type(
721 tag,
722 ::buffa::encoding::WireType::LengthDelimited,
723 )?;
724 if let ::core::option::Option::Some(
725 __buffa::oneof::value::Kind::StructValue(ref mut existing),
726 ) = self.kind
727 {
728 ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
729 } else {
730 let mut val = ::core::default::Default::default();
731 ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
732 self.kind = ::core::option::Option::Some(
733 __buffa::oneof::value::Kind::StructValue(
734 ::buffa::alloc::boxed::Box::new(val),
735 ),
736 );
737 }
738 }
739 6u32 => {
740 ::buffa::encoding::check_wire_type(
741 tag,
742 ::buffa::encoding::WireType::LengthDelimited,
743 )?;
744 if let ::core::option::Option::Some(
745 __buffa::oneof::value::Kind::ListValue(ref mut existing),
746 ) = self.kind
747 {
748 ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
749 } else {
750 let mut val = ::core::default::Default::default();
751 ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
752 self.kind = ::core::option::Option::Some(
753 __buffa::oneof::value::Kind::ListValue(
754 ::buffa::alloc::boxed::Box::new(val),
755 ),
756 );
757 }
758 }
759 _ => {
760 self.__buffa_unknown_fields
761 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
762 }
763 }
764 ::core::result::Result::Ok(())
765 }
766 fn clear(&mut self) {
767 self.kind = ::core::option::Option::None;
768 self.__buffa_unknown_fields.clear();
769 }
770}
771impl ::buffa::ExtensionSet for Value {
772 const PROTO_FQN: &'static str = "google.protobuf.Value";
773 fn unknown_fields(&self) -> &::buffa::UnknownFields {
774 &self.__buffa_unknown_fields
775 }
776 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
777 &mut self.__buffa_unknown_fields
778 }
779}
780impl ::buffa::text::TextFormat for Value {
781 fn encode_text(
782 &self,
783 enc: &mut ::buffa::text::TextEncoder<'_>,
784 ) -> ::core::fmt::Result {
785 #[allow(unused_imports)]
786 use ::buffa::Enumeration as _;
787 if let ::core::option::Option::Some(ref __v) = self.kind {
788 match __v {
789 __buffa::oneof::value::Kind::NullValue(__v) => {
790 enc.write_field_name("null_value")?;
791 match __v {
792 ::buffa::EnumValue::Known(__e) => {
793 enc.write_enum_name(__e.proto_name())?
794 }
795 ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
796 }
797 }
798 __buffa::oneof::value::Kind::NumberValue(__v) => {
799 enc.write_field_name("number_value")?;
800 enc.write_f64(*__v)?;
801 }
802 __buffa::oneof::value::Kind::StringValue(__v) => {
803 enc.write_field_name("string_value")?;
804 enc.write_string(__v)?;
805 }
806 __buffa::oneof::value::Kind::BoolValue(__v) => {
807 enc.write_field_name("bool_value")?;
808 enc.write_bool(*__v)?;
809 }
810 __buffa::oneof::value::Kind::StructValue(__v) => {
811 enc.write_field_name("struct_value")?;
812 enc.write_message(&**__v)?;
813 }
814 __buffa::oneof::value::Kind::ListValue(__v) => {
815 enc.write_field_name("list_value")?;
816 enc.write_message(&**__v)?;
817 }
818 }
819 }
820 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
821 ::core::result::Result::Ok(())
822 }
823 fn merge_text(
824 &mut self,
825 dec: &mut ::buffa::text::TextDecoder<'_>,
826 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
827 #[allow(unused_imports)]
828 use ::buffa::Enumeration as _;
829 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
830 match __name {
831 "null_value" => {
832 self.kind = ::core::option::Option::Some(
833 __buffa::oneof::value::Kind::NullValue(
834 dec
835 .read_enum_by_name::<NullValue>()
836 .map(::buffa::EnumValue::from)?,
837 ),
838 );
839 }
840 "number_value" => {
841 self.kind = ::core::option::Option::Some(
842 __buffa::oneof::value::Kind::NumberValue(dec.read_f64()?),
843 );
844 }
845 "string_value" => {
846 self.kind = ::core::option::Option::Some(
847 __buffa::oneof::value::Kind::StringValue(
848 dec.read_string()?.into_owned(),
849 ),
850 );
851 }
852 "bool_value" => {
853 self.kind = ::core::option::Option::Some(
854 __buffa::oneof::value::Kind::BoolValue(dec.read_bool()?),
855 );
856 }
857 "struct_value" => {
858 if let ::core::option::Option::Some(
859 __buffa::oneof::value::Kind::StructValue(ref mut __existing),
860 ) = self.kind
861 {
862 dec.merge_message(&mut **__existing)?;
863 } else {
864 let mut __m = ::core::default::Default::default();
865 dec.merge_message(&mut __m)?;
866 self.kind = ::core::option::Option::Some(
867 __buffa::oneof::value::Kind::StructValue(
868 ::buffa::alloc::boxed::Box::new(__m),
869 ),
870 );
871 }
872 }
873 "list_value" => {
874 if let ::core::option::Option::Some(
875 __buffa::oneof::value::Kind::ListValue(ref mut __existing),
876 ) = self.kind
877 {
878 dec.merge_message(&mut **__existing)?;
879 } else {
880 let mut __m = ::core::default::Default::default();
881 dec.merge_message(&mut __m)?;
882 self.kind = ::core::option::Option::Some(
883 __buffa::oneof::value::Kind::ListValue(
884 ::buffa::alloc::boxed::Box::new(__m),
885 ),
886 );
887 }
888 }
889 _ => dec.skip_value()?,
890 }
891 }
892 ::core::result::Result::Ok(())
893 }
894}
895#[doc(hidden)]
896pub const __VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
897 type_url: "type.googleapis.com/google.protobuf.Value",
898 text_encode: ::buffa::type_registry::any_encode_text::<Value>,
899 text_merge: ::buffa::type_registry::any_merge_text::<Value>,
900};
901pub mod value {
902 #[allow(unused_imports)]
903 use super::*;
904 #[doc(inline)]
905 pub use super::__buffa::oneof::value::Kind;
906 #[doc(inline)]
907 pub use super::__buffa::view::oneof::value::Kind as KindView;
908}
909#[derive(Clone, PartialEq, Default)]
913#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
914pub struct ListValue {
915 pub values: ::buffa::alloc::vec::Vec<Value>,
919 #[doc(hidden)]
920 pub __buffa_unknown_fields: ::buffa::UnknownFields,
921}
922impl ::core::fmt::Debug for ListValue {
923 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
924 f.debug_struct("ListValue").field("values", &self.values).finish()
925 }
926}
927impl ListValue {
928 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ListValue";
933}
934::buffa::impl_default_instance!(ListValue);
935#[cfg(feature = "reflect")]
936const _: () = {
937 impl ::buffa_descriptor::reflect::ReflectMessage for ListValue {
938 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
939 __buffa::reflect::descriptor_pool()
940 .message(Self::__buffa_reflect_message_index())
941 }
942 fn pool(
943 &self,
944 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
945 __buffa::reflect::descriptor_pool()
946 }
947 fn unknown_fields(&self) -> &::buffa::UnknownFields {
948 &self.__buffa_unknown_fields
949 }
950 fn get(
951 &self,
952 field: &::buffa_descriptor::FieldDescriptor,
953 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
954 #[allow(unused_imports)]
955 use ::buffa::Enumeration as _;
956 match field.number() {
957 1u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.values),
958 _ => {
959 ::core::debug_assert!(
960 false,
961 "field number {} is not a member of this message's reflect get()",
962 field.number(),
963 );
964 ::buffa_descriptor::reflect::ValueRef::Bool(false)
965 }
966 }
967 }
968 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
969 match field.number() {
970 1u32 => !self.values.is_empty(),
971 _ => false,
972 }
973 }
974 fn for_each_set(
975 &self,
976 f: &mut dyn ::core::ops::FnMut(
977 &::buffa_descriptor::FieldDescriptor,
978 ::buffa_descriptor::reflect::ValueRef<'_>,
979 ),
980 ) {
981 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
982 self,
983 );
984 for fd in md.fields() {
985 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
986 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
987 }
988 }
989 }
990 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
991 ::buffa_descriptor::reflect::DynamicMessage::from_message(
992 self,
993 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
994 Self::__buffa_reflect_message_index(),
995 )
996 }
997 }
998 impl ::buffa_descriptor::reflect::ReflectElement for ListValue {
999 #[inline]
1000 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1001 ::buffa_descriptor::reflect::ValueRef::Message(
1002 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1003 )
1004 }
1005 }
1006 impl ListValue {
1007 #[doc(hidden)]
1010 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1011 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1012 *IDX
1013 .get_or_init(|| {
1014 __buffa::reflect::descriptor_pool()
1015 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1016 .expect(
1017 "generated message is registered in the embedded descriptor pool",
1018 )
1019 })
1020 }
1021 }
1022 impl ::buffa_descriptor::reflect::Reflectable for ListValue {
1023 #[inline]
1027 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
1028 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
1029 }
1030 }
1031};
1032impl ::buffa::MessageName for ListValue {
1033 const PACKAGE: &'static str = "google.protobuf";
1034 const NAME: &'static str = "ListValue";
1035 const FULL_NAME: &'static str = "google.protobuf.ListValue";
1036 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ListValue";
1037}
1038impl ::buffa::Message for ListValue {
1039 #[allow(clippy::let_and_return)]
1047 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1048 #[allow(unused_imports)]
1049 use ::buffa::Enumeration as _;
1050 let mut size = 0u64;
1051 for v in &self.values {
1052 let __slot = __cache.reserve();
1053 let inner_size = v.compute_size(__cache);
1054 __cache.set(__slot, inner_size);
1055 size
1056 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1057 + inner_size as u64;
1058 }
1059 size += self.__buffa_unknown_fields.encoded_len() as u64;
1060 ::buffa::saturate_size(size)
1061 }
1062 fn write_to(
1063 &self,
1064 __cache: &mut ::buffa::SizeCache,
1065 buf: &mut impl ::buffa::EncodeSink,
1066 ) {
1067 #[allow(unused_imports)]
1068 use ::buffa::Enumeration as _;
1069 for v in &self.values {
1070 ::buffa::types::put_len_delimited_header(
1071 1u32,
1072 u64::from(__cache.consume_next()),
1073 buf,
1074 );
1075 v.write_to(__cache, buf);
1076 }
1077 self.__buffa_unknown_fields.write_to(buf);
1078 }
1079 fn merge_field(
1080 &mut self,
1081 tag: ::buffa::encoding::Tag,
1082 buf: &mut impl ::buffa::bytes::Buf,
1083 ctx: ::buffa::DecodeContext<'_>,
1084 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1085 #[allow(unused_imports)]
1086 use ::buffa::bytes::Buf as _;
1087 #[allow(unused_imports)]
1088 use ::buffa::Enumeration as _;
1089 match tag.field_number() {
1090 1u32 => {
1091 ::buffa::encoding::check_wire_type(
1092 tag,
1093 ::buffa::encoding::WireType::LengthDelimited,
1094 )?;
1095 let mut elem = ::core::default::Default::default();
1096 ctx.register_element_memory(
1097 ::buffa::__private::element_footprint(&elem),
1098 )?;
1099 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
1100 self.values.push(elem);
1101 }
1102 _ => {
1103 self.__buffa_unknown_fields
1104 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1105 }
1106 }
1107 ::core::result::Result::Ok(())
1108 }
1109 fn clear(&mut self) {
1110 self.values.clear();
1111 self.__buffa_unknown_fields.clear();
1112 }
1113}
1114impl ::buffa::ExtensionSet for ListValue {
1115 const PROTO_FQN: &'static str = "google.protobuf.ListValue";
1116 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1117 &self.__buffa_unknown_fields
1118 }
1119 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1120 &mut self.__buffa_unknown_fields
1121 }
1122}
1123impl ::buffa::text::TextFormat for ListValue {
1124 fn encode_text(
1125 &self,
1126 enc: &mut ::buffa::text::TextEncoder<'_>,
1127 ) -> ::core::fmt::Result {
1128 #[allow(unused_imports)]
1129 use ::buffa::Enumeration as _;
1130 for __v in &self.values {
1131 enc.write_field_name("values")?;
1132 enc.write_message(__v)?;
1133 }
1134 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1135 ::core::result::Result::Ok(())
1136 }
1137 fn merge_text(
1138 &mut self,
1139 dec: &mut ::buffa::text::TextDecoder<'_>,
1140 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1141 #[allow(unused_imports)]
1142 use ::buffa::Enumeration as _;
1143 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1144 match __name {
1145 "values" => {
1146 dec.read_repeated_into(
1147 &mut self.values,
1148 |__d| {
1149 let mut __m = ::core::default::Default::default();
1150 __d.merge_message(&mut __m)?;
1151 ::core::result::Result::Ok(__m)
1152 },
1153 )?
1154 }
1155 _ => dec.skip_value()?,
1156 }
1157 }
1158 ::core::result::Result::Ok(())
1159 }
1160}
1161#[doc(hidden)]
1162pub const __LIST_VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1163 type_url: "type.googleapis.com/google.protobuf.ListValue",
1164 text_encode: ::buffa::type_registry::any_encode_text::<ListValue>,
1165 text_merge: ::buffa::type_registry::any_merge_text::<ListValue>,
1166};