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