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}
80impl ::buffa::DefaultInstance for Struct {
81 fn default_instance() -> &'static Self {
82 static VALUE: ::buffa::__private::OnceBox<Struct> = ::buffa::__private::OnceBox::new();
83 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
84 }
85}
86#[cfg(feature = "reflect")]
87const _: () = {
88 impl ::buffa_descriptor::reflect::ReflectMessage for Struct {
89 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
90 __buffa::reflect::descriptor_pool()
91 .message(Self::__buffa_reflect_message_index())
92 }
93 fn pool(
94 &self,
95 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
96 __buffa::reflect::descriptor_pool()
97 }
98 fn unknown_fields(&self) -> &::buffa::UnknownFields {
99 &self.__buffa_unknown_fields
100 }
101 fn get(
102 &self,
103 field: &::buffa_descriptor::FieldDescriptor,
104 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
105 #[allow(unused_imports)]
106 use ::buffa::Enumeration as _;
107 match field.number() {
108 1u32 => ::buffa_descriptor::reflect::ValueRef::Map(&self.fields),
109 _ => {
110 ::core::debug_assert!(
111 false,
112 "field number {} is not a member of this message's reflect get()",
113 field.number(),
114 );
115 ::buffa_descriptor::reflect::ValueRef::Bool(false)
116 }
117 }
118 }
119 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
120 match field.number() {
121 1u32 => !self.fields.is_empty(),
122 _ => false,
123 }
124 }
125 fn for_each_set(
126 &self,
127 f: &mut dyn ::core::ops::FnMut(
128 &::buffa_descriptor::FieldDescriptor,
129 ::buffa_descriptor::reflect::ValueRef<'_>,
130 ),
131 ) {
132 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
133 self,
134 );
135 for fd in md.fields() {
136 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
137 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
138 }
139 }
140 }
141 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
142 ::buffa_descriptor::reflect::DynamicMessage::from_message(
143 self,
144 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
145 Self::__buffa_reflect_message_index(),
146 )
147 }
148 }
149 impl ::buffa_descriptor::reflect::ReflectElement for Struct {
150 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
151 ::buffa_descriptor::reflect::ValueRef::Message(
152 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
153 )
154 }
155 }
156 impl Struct {
157 #[doc(hidden)]
160 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
161 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
162 *IDX
163 .get_or_init(|| {
164 __buffa::reflect::descriptor_pool()
165 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
166 .expect(
167 "generated message is registered in the embedded descriptor pool",
168 )
169 })
170 }
171 }
172 impl ::buffa_descriptor::reflect::Reflectable for Struct {
173 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
177 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
178 }
179 }
180};
181impl ::buffa::MessageName for Struct {
182 const PACKAGE: &'static str = "google.protobuf";
183 const NAME: &'static str = "Struct";
184 const FULL_NAME: &'static str = "google.protobuf.Struct";
185 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Struct";
186}
187impl ::buffa::Message for Struct {
188 #[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 = 0u32;
198 #[allow(clippy::for_kv_map)]
199 for (k, v) in &self.fields {
200 let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
201 + 1u32
202 + {
203 let __slot = __cache.reserve();
204 let inner = v.compute_size(__cache);
205 __cache.set(__slot, inner);
206 ::buffa::encoding::varint_len(inner as u64) as u32 + inner
207 };
208 size
209 += 1u32 + ::buffa::encoding::varint_len(entry_size as u64) as u32
210 + entry_size;
211 }
212 size += self.__buffa_unknown_fields.encoded_len() as u32;
213 size
214 }
215 fn write_to(
216 &self,
217 __cache: &mut ::buffa::SizeCache,
218 buf: &mut impl ::buffa::bytes::BufMut,
219 ) {
220 #[allow(unused_imports)]
221 use ::buffa::Enumeration as _;
222 for (k, v) in &self.fields {
223 let __v_len = __cache.consume_next();
224 let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
225 + 1u32
226 + (::buffa::encoding::varint_len(__v_len as u64) as u32 + __v_len);
227 ::buffa::encoding::Tag::new(
228 1u32,
229 ::buffa::encoding::WireType::LengthDelimited,
230 )
231 .encode(buf);
232 ::buffa::encoding::encode_varint(entry_size as u64, buf);
233 ::buffa::encoding::Tag::new(
234 1u32,
235 ::buffa::encoding::WireType::LengthDelimited,
236 )
237 .encode(buf);
238 ::buffa::types::encode_string(k, buf);
239 ::buffa::encoding::Tag::new(
240 2u32,
241 ::buffa::encoding::WireType::LengthDelimited,
242 )
243 .encode(buf);
244 ::buffa::encoding::encode_varint(__v_len as u64, buf);
245 v.write_to(__cache, buf);
246 }
247 self.__buffa_unknown_fields.write_to(buf);
248 }
249 fn merge_field(
250 &mut self,
251 tag: ::buffa::encoding::Tag,
252 buf: &mut impl ::buffa::bytes::Buf,
253 depth: u32,
254 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
255 #[allow(unused_imports)]
256 use ::buffa::bytes::Buf as _;
257 #[allow(unused_imports)]
258 use ::buffa::Enumeration as _;
259 match tag.field_number() {
260 1u32 => {
261 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
262 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
263 field_number: 1u32,
264 expected: 2u8,
265 actual: tag.wire_type() as u8,
266 });
267 }
268 let entry_len = ::buffa::encoding::decode_varint(buf)?;
269 let entry_len = usize::try_from(entry_len)
270 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
271 if buf.remaining() < entry_len {
272 return ::core::result::Result::Err(
273 ::buffa::DecodeError::UnexpectedEof,
274 );
275 }
276 let entry_limit = buf.remaining() - entry_len;
277 let mut key = ::core::default::Default::default();
278 let mut val = ::core::default::Default::default();
279 while buf.remaining() > entry_limit {
280 let entry_tag = ::buffa::encoding::Tag::decode(buf)?;
281 match entry_tag.field_number() {
282 1 => {
283 if entry_tag.wire_type()
284 != ::buffa::encoding::WireType::LengthDelimited
285 {
286 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
287 field_number: entry_tag.field_number(),
288 expected: 2u8,
289 actual: entry_tag.wire_type() as u8,
290 });
291 }
292 key = ::buffa::types::decode_string(buf)?;
293 }
294 2 => {
295 if entry_tag.wire_type()
296 != ::buffa::encoding::WireType::LengthDelimited
297 {
298 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
299 field_number: entry_tag.field_number(),
300 expected: 2u8,
301 actual: entry_tag.wire_type() as u8,
302 });
303 }
304 ::buffa::Message::merge_length_delimited(
305 &mut val,
306 buf,
307 depth,
308 )?;
309 }
310 _ => {
311 ::buffa::encoding::skip_field_depth(entry_tag, buf, depth)?;
312 }
313 }
314 }
315 if buf.remaining() != entry_limit {
316 let remaining = buf.remaining();
317 if remaining > entry_limit {
318 buf.advance(remaining - entry_limit);
319 } else {
320 return ::core::result::Result::Err(
321 ::buffa::DecodeError::UnexpectedEof,
322 );
323 }
324 }
325 self.fields.insert(key, val);
326 }
327 _ => {
328 self.__buffa_unknown_fields
329 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
330 }
331 }
332 ::core::result::Result::Ok(())
333 }
334 fn clear(&mut self) {
335 self.fields.clear();
336 self.__buffa_unknown_fields.clear();
337 }
338}
339impl ::buffa::ExtensionSet for Struct {
340 const PROTO_FQN: &'static str = "google.protobuf.Struct";
341 fn unknown_fields(&self) -> &::buffa::UnknownFields {
342 &self.__buffa_unknown_fields
343 }
344 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
345 &mut self.__buffa_unknown_fields
346 }
347}
348impl ::buffa::text::TextFormat for Struct {
349 fn encode_text(
350 &self,
351 enc: &mut ::buffa::text::TextEncoder<'_>,
352 ) -> ::core::fmt::Result {
353 #[allow(unused_imports)]
354 use ::buffa::Enumeration as _;
355 for (__k, __v) in &self.fields {
356 enc.write_field_name("fields")?;
357 enc.write_map_entry(|enc| {
358 enc.write_field_name("key")?;
359 enc.write_string(__k)?;
360 enc.write_field_name("value")?;
361 enc.write_message(__v)?;
362 ::core::result::Result::Ok(())
363 })?;
364 }
365 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
366 ::core::result::Result::Ok(())
367 }
368 fn merge_text(
369 &mut self,
370 dec: &mut ::buffa::text::TextDecoder<'_>,
371 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
372 #[allow(unused_imports)]
373 use ::buffa::Enumeration as _;
374 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
375 match __name {
376 "fields" => {
377 let mut __pairs: ::buffa::alloc::vec::Vec<_> = ::buffa::alloc::vec::Vec::new();
378 dec.read_repeated_into(
379 &mut __pairs,
380 |__d| {
381 let mut __k = ::core::option::Option::None;
382 let mut __v = ::core::option::Option::None;
383 __d.merge_map_entry(|__d| {
384 while let ::core::option::Option::Some(__n) = __d
385 .read_field_name()?
386 {
387 match __n {
388 "key" => {
389 __k = ::core::option::Option::Some(
390 __d.read_string()?.into_owned(),
391 );
392 }
393 "value" => {
394 __v = ::core::option::Option::Some({
395 let mut __m = ::core::default::Default::default();
396 __d.merge_message(&mut __m)?;
397 __m
398 });
399 }
400 _ => __d.skip_value()?,
401 }
402 }
403 ::core::result::Result::Ok(())
404 })?;
405 ::core::result::Result::Ok((
406 __k.unwrap_or_default(),
407 __v.unwrap_or_default(),
408 ))
409 },
410 )?;
411 for (__k, __v) in __pairs {
412 self.fields.insert(__k, __v);
413 }
414 }
415 _ => dec.skip_value()?,
416 }
417 }
418 ::core::result::Result::Ok(())
419 }
420}
421#[doc(hidden)]
422pub const __STRUCT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
423 type_url: "type.googleapis.com/google.protobuf.Struct",
424 text_encode: ::buffa::type_registry::any_encode_text::<Struct>,
425 text_merge: ::buffa::type_registry::any_merge_text::<Struct>,
426};
427#[derive(Clone, PartialEq, Default)]
434#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
435pub struct Value {
436 pub kind: ::core::option::Option<__buffa::oneof::value::Kind>,
437 #[doc(hidden)]
438 pub __buffa_unknown_fields: ::buffa::UnknownFields,
439}
440impl ::core::fmt::Debug for Value {
441 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
442 f.debug_struct("Value").field("kind", &self.kind).finish()
443 }
444}
445impl Value {
446 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Value";
451}
452impl ::buffa::DefaultInstance for Value {
453 fn default_instance() -> &'static Self {
454 static VALUE: ::buffa::__private::OnceBox<Value> = ::buffa::__private::OnceBox::new();
455 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
456 }
457}
458#[cfg(feature = "reflect")]
459const _: () = {
460 impl ::buffa_descriptor::reflect::ReflectMessage for Value {
461 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
462 __buffa::reflect::descriptor_pool()
463 .message(Self::__buffa_reflect_message_index())
464 }
465 fn pool(
466 &self,
467 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
468 __buffa::reflect::descriptor_pool()
469 }
470 fn unknown_fields(&self) -> &::buffa::UnknownFields {
471 &self.__buffa_unknown_fields
472 }
473 fn get(
474 &self,
475 field: &::buffa_descriptor::FieldDescriptor,
476 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
477 #[allow(unused_imports)]
478 use ::buffa::Enumeration as _;
479 match field.number() {
480 1u32 => {
481 match &self.kind {
482 ::core::option::Option::Some(
483 __buffa::oneof::value::Kind::NullValue(v),
484 ) => {
485 ::buffa_descriptor::reflect::ValueRef::EnumNumber(v.to_i32())
486 }
487 _ => ::buffa_descriptor::reflect::ValueRef::EnumNumber(0),
488 }
489 }
490 2u32 => {
491 match &self.kind {
492 ::core::option::Option::Some(
493 __buffa::oneof::value::Kind::NumberValue(v),
494 ) => ::buffa_descriptor::reflect::ValueRef::F64(*v),
495 _ => ::buffa_descriptor::reflect::ValueRef::F64(0.0),
496 }
497 }
498 3u32 => {
499 match &self.kind {
500 ::core::option::Option::Some(
501 __buffa::oneof::value::Kind::StringValue(v),
502 ) => ::buffa_descriptor::reflect::ValueRef::String(v),
503 _ => ::buffa_descriptor::reflect::ValueRef::String(""),
504 }
505 }
506 4u32 => {
507 match &self.kind {
508 ::core::option::Option::Some(
509 __buffa::oneof::value::Kind::BoolValue(v),
510 ) => ::buffa_descriptor::reflect::ValueRef::Bool(*v),
511 _ => ::buffa_descriptor::reflect::ValueRef::Bool(false),
512 }
513 }
514 5u32 => {
515 match &self.kind {
516 ::core::option::Option::Some(
517 __buffa::oneof::value::Kind::StructValue(v),
518 ) => {
519 ::buffa_descriptor::reflect::ValueRef::Message(
520 ::buffa_descriptor::reflect::ReflectCow::Borrowed(&**v),
521 )
522 }
523 _ => {
524 ::buffa_descriptor::reflect::ValueRef::Message(
525 ::buffa_descriptor::reflect::ReflectCow::Borrowed(
526 <Struct as ::buffa::DefaultInstance>::default_instance(),
527 ),
528 )
529 }
530 }
531 }
532 6u32 => {
533 match &self.kind {
534 ::core::option::Option::Some(
535 __buffa::oneof::value::Kind::ListValue(v),
536 ) => {
537 ::buffa_descriptor::reflect::ValueRef::Message(
538 ::buffa_descriptor::reflect::ReflectCow::Borrowed(&**v),
539 )
540 }
541 _ => {
542 ::buffa_descriptor::reflect::ValueRef::Message(
543 ::buffa_descriptor::reflect::ReflectCow::Borrowed(
544 <ListValue as ::buffa::DefaultInstance>::default_instance(),
545 ),
546 )
547 }
548 }
549 }
550 _ => {
551 ::core::debug_assert!(
552 false,
553 "field number {} is not a member of this message's reflect get()",
554 field.number(),
555 );
556 ::buffa_descriptor::reflect::ValueRef::Bool(false)
557 }
558 }
559 }
560 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
561 match field.number() {
562 1u32 => {
563 ::core::matches!(
564 & self.kind,
565 ::core::option::Option::Some(__buffa::oneof::value::Kind::NullValue(_))
566 )
567 }
568 2u32 => {
569 ::core::matches!(
570 & self.kind,
571 ::core::option::Option::Some(__buffa::oneof::value::Kind::NumberValue(_))
572 )
573 }
574 3u32 => {
575 ::core::matches!(
576 & self.kind,
577 ::core::option::Option::Some(__buffa::oneof::value::Kind::StringValue(_))
578 )
579 }
580 4u32 => {
581 ::core::matches!(
582 & self.kind,
583 ::core::option::Option::Some(__buffa::oneof::value::Kind::BoolValue(_))
584 )
585 }
586 5u32 => {
587 ::core::matches!(
588 & self.kind,
589 ::core::option::Option::Some(__buffa::oneof::value::Kind::StructValue(_))
590 )
591 }
592 6u32 => {
593 ::core::matches!(
594 & self.kind,
595 ::core::option::Option::Some(__buffa::oneof::value::Kind::ListValue(_))
596 )
597 }
598 _ => false,
599 }
600 }
601 fn for_each_set(
602 &self,
603 f: &mut dyn ::core::ops::FnMut(
604 &::buffa_descriptor::FieldDescriptor,
605 ::buffa_descriptor::reflect::ValueRef<'_>,
606 ),
607 ) {
608 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
609 self,
610 );
611 for fd in md.fields() {
612 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
613 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
614 }
615 }
616 }
617 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
618 ::buffa_descriptor::reflect::DynamicMessage::from_message(
619 self,
620 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
621 Self::__buffa_reflect_message_index(),
622 )
623 }
624 }
625 impl ::buffa_descriptor::reflect::ReflectElement for Value {
626 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
627 ::buffa_descriptor::reflect::ValueRef::Message(
628 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
629 )
630 }
631 }
632 impl Value {
633 #[doc(hidden)]
636 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
637 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
638 *IDX
639 .get_or_init(|| {
640 __buffa::reflect::descriptor_pool()
641 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
642 .expect(
643 "generated message is registered in the embedded descriptor pool",
644 )
645 })
646 }
647 }
648 impl ::buffa_descriptor::reflect::Reflectable for Value {
649 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
653 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
654 }
655 }
656};
657impl ::buffa::MessageName for Value {
658 const PACKAGE: &'static str = "google.protobuf";
659 const NAME: &'static str = "Value";
660 const FULL_NAME: &'static str = "google.protobuf.Value";
661 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Value";
662}
663impl ::buffa::Message for Value {
664 #[allow(clippy::let_and_return)]
670 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
671 #[allow(unused_imports)]
672 use ::buffa::Enumeration as _;
673 let mut size = 0u32;
674 if let ::core::option::Option::Some(ref v) = self.kind {
675 match v {
676 __buffa::oneof::value::Kind::NullValue(x) => {
677 size += 1u32 + ::buffa::types::int32_encoded_len(x.to_i32()) as u32;
678 }
679 __buffa::oneof::value::Kind::NumberValue(_x) => {
680 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
681 }
682 __buffa::oneof::value::Kind::StringValue(x) => {
683 size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
684 }
685 __buffa::oneof::value::Kind::BoolValue(_x) => {
686 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
687 }
688 __buffa::oneof::value::Kind::StructValue(x) => {
689 let __slot = __cache.reserve();
690 let inner = x.compute_size(__cache);
691 __cache.set(__slot, inner);
692 size
693 += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
694 + inner;
695 }
696 __buffa::oneof::value::Kind::ListValue(x) => {
697 let __slot = __cache.reserve();
698 let inner = x.compute_size(__cache);
699 __cache.set(__slot, inner);
700 size
701 += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
702 + inner;
703 }
704 }
705 }
706 size += self.__buffa_unknown_fields.encoded_len() as u32;
707 size
708 }
709 fn write_to(
710 &self,
711 __cache: &mut ::buffa::SizeCache,
712 buf: &mut impl ::buffa::bytes::BufMut,
713 ) {
714 #[allow(unused_imports)]
715 use ::buffa::Enumeration as _;
716 if let ::core::option::Option::Some(ref v) = self.kind {
717 match v {
718 __buffa::oneof::value::Kind::NullValue(x) => {
719 ::buffa::encoding::Tag::new(
720 1u32,
721 ::buffa::encoding::WireType::Varint,
722 )
723 .encode(buf);
724 ::buffa::types::encode_int32(x.to_i32(), buf);
725 }
726 __buffa::oneof::value::Kind::NumberValue(x) => {
727 ::buffa::encoding::Tag::new(
728 2u32,
729 ::buffa::encoding::WireType::Fixed64,
730 )
731 .encode(buf);
732 ::buffa::types::encode_double(*x, buf);
733 }
734 __buffa::oneof::value::Kind::StringValue(x) => {
735 ::buffa::encoding::Tag::new(
736 3u32,
737 ::buffa::encoding::WireType::LengthDelimited,
738 )
739 .encode(buf);
740 ::buffa::types::encode_string(x, buf);
741 }
742 __buffa::oneof::value::Kind::BoolValue(x) => {
743 ::buffa::encoding::Tag::new(
744 4u32,
745 ::buffa::encoding::WireType::Varint,
746 )
747 .encode(buf);
748 ::buffa::types::encode_bool(*x, buf);
749 }
750 __buffa::oneof::value::Kind::StructValue(x) => {
751 ::buffa::encoding::Tag::new(
752 5u32,
753 ::buffa::encoding::WireType::LengthDelimited,
754 )
755 .encode(buf);
756 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
757 x.write_to(__cache, buf);
758 }
759 __buffa::oneof::value::Kind::ListValue(x) => {
760 ::buffa::encoding::Tag::new(
761 6u32,
762 ::buffa::encoding::WireType::LengthDelimited,
763 )
764 .encode(buf);
765 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
766 x.write_to(__cache, buf);
767 }
768 }
769 }
770 self.__buffa_unknown_fields.write_to(buf);
771 }
772 fn merge_field(
773 &mut self,
774 tag: ::buffa::encoding::Tag,
775 buf: &mut impl ::buffa::bytes::Buf,
776 depth: u32,
777 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
778 #[allow(unused_imports)]
779 use ::buffa::bytes::Buf as _;
780 #[allow(unused_imports)]
781 use ::buffa::Enumeration as _;
782 match tag.field_number() {
783 1u32 => {
784 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
785 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
786 field_number: 1u32,
787 expected: 0u8,
788 actual: tag.wire_type() as u8,
789 });
790 }
791 self.kind = ::core::option::Option::Some(
792 __buffa::oneof::value::Kind::NullValue(
793 ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
794 ),
795 );
796 }
797 2u32 => {
798 if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
799 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
800 field_number: 2u32,
801 expected: 1u8,
802 actual: tag.wire_type() as u8,
803 });
804 }
805 self.kind = ::core::option::Option::Some(
806 __buffa::oneof::value::Kind::NumberValue(
807 ::buffa::types::decode_double(buf)?,
808 ),
809 );
810 }
811 3u32 => {
812 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
813 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
814 field_number: 3u32,
815 expected: 2u8,
816 actual: tag.wire_type() as u8,
817 });
818 }
819 self.kind = ::core::option::Option::Some(
820 __buffa::oneof::value::Kind::StringValue(
821 ::buffa::types::decode_string(buf)?,
822 ),
823 );
824 }
825 4u32 => {
826 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
827 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
828 field_number: 4u32,
829 expected: 0u8,
830 actual: tag.wire_type() as u8,
831 });
832 }
833 self.kind = ::core::option::Option::Some(
834 __buffa::oneof::value::Kind::BoolValue(
835 ::buffa::types::decode_bool(buf)?,
836 ),
837 );
838 }
839 5u32 => {
840 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
841 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
842 field_number: 5u32,
843 expected: 2u8,
844 actual: tag.wire_type() as u8,
845 });
846 }
847 if let ::core::option::Option::Some(
848 __buffa::oneof::value::Kind::StructValue(ref mut existing),
849 ) = self.kind
850 {
851 ::buffa::Message::merge_length_delimited(
852 &mut **existing,
853 buf,
854 depth,
855 )?;
856 } else {
857 let mut val = ::core::default::Default::default();
858 ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
859 self.kind = ::core::option::Option::Some(
860 __buffa::oneof::value::Kind::StructValue(
861 ::buffa::alloc::boxed::Box::new(val),
862 ),
863 );
864 }
865 }
866 6u32 => {
867 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
868 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
869 field_number: 6u32,
870 expected: 2u8,
871 actual: tag.wire_type() as u8,
872 });
873 }
874 if let ::core::option::Option::Some(
875 __buffa::oneof::value::Kind::ListValue(ref mut existing),
876 ) = self.kind
877 {
878 ::buffa::Message::merge_length_delimited(
879 &mut **existing,
880 buf,
881 depth,
882 )?;
883 } else {
884 let mut val = ::core::default::Default::default();
885 ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
886 self.kind = ::core::option::Option::Some(
887 __buffa::oneof::value::Kind::ListValue(
888 ::buffa::alloc::boxed::Box::new(val),
889 ),
890 );
891 }
892 }
893 _ => {
894 self.__buffa_unknown_fields
895 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
896 }
897 }
898 ::core::result::Result::Ok(())
899 }
900 fn clear(&mut self) {
901 self.kind = ::core::option::Option::None;
902 self.__buffa_unknown_fields.clear();
903 }
904}
905impl ::buffa::ExtensionSet for Value {
906 const PROTO_FQN: &'static str = "google.protobuf.Value";
907 fn unknown_fields(&self) -> &::buffa::UnknownFields {
908 &self.__buffa_unknown_fields
909 }
910 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
911 &mut self.__buffa_unknown_fields
912 }
913}
914impl ::buffa::text::TextFormat for Value {
915 fn encode_text(
916 &self,
917 enc: &mut ::buffa::text::TextEncoder<'_>,
918 ) -> ::core::fmt::Result {
919 #[allow(unused_imports)]
920 use ::buffa::Enumeration as _;
921 if let ::core::option::Option::Some(ref __v) = self.kind {
922 match __v {
923 __buffa::oneof::value::Kind::NullValue(__v) => {
924 enc.write_field_name("null_value")?;
925 match __v {
926 ::buffa::EnumValue::Known(__e) => {
927 enc.write_enum_name(__e.proto_name())?
928 }
929 ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
930 }
931 }
932 __buffa::oneof::value::Kind::NumberValue(__v) => {
933 enc.write_field_name("number_value")?;
934 enc.write_f64(*__v)?;
935 }
936 __buffa::oneof::value::Kind::StringValue(__v) => {
937 enc.write_field_name("string_value")?;
938 enc.write_string(__v)?;
939 }
940 __buffa::oneof::value::Kind::BoolValue(__v) => {
941 enc.write_field_name("bool_value")?;
942 enc.write_bool(*__v)?;
943 }
944 __buffa::oneof::value::Kind::StructValue(__v) => {
945 enc.write_field_name("struct_value")?;
946 enc.write_message(&**__v)?;
947 }
948 __buffa::oneof::value::Kind::ListValue(__v) => {
949 enc.write_field_name("list_value")?;
950 enc.write_message(&**__v)?;
951 }
952 }
953 }
954 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
955 ::core::result::Result::Ok(())
956 }
957 fn merge_text(
958 &mut self,
959 dec: &mut ::buffa::text::TextDecoder<'_>,
960 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
961 #[allow(unused_imports)]
962 use ::buffa::Enumeration as _;
963 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
964 match __name {
965 "null_value" => {
966 self.kind = ::core::option::Option::Some(
967 __buffa::oneof::value::Kind::NullValue(
968 dec
969 .read_enum_by_name::<NullValue>()
970 .map(::buffa::EnumValue::from)?,
971 ),
972 );
973 }
974 "number_value" => {
975 self.kind = ::core::option::Option::Some(
976 __buffa::oneof::value::Kind::NumberValue(dec.read_f64()?),
977 );
978 }
979 "string_value" => {
980 self.kind = ::core::option::Option::Some(
981 __buffa::oneof::value::Kind::StringValue(
982 dec.read_string()?.into_owned(),
983 ),
984 );
985 }
986 "bool_value" => {
987 self.kind = ::core::option::Option::Some(
988 __buffa::oneof::value::Kind::BoolValue(dec.read_bool()?),
989 );
990 }
991 "struct_value" => {
992 if let ::core::option::Option::Some(
993 __buffa::oneof::value::Kind::StructValue(ref mut __existing),
994 ) = self.kind
995 {
996 dec.merge_message(&mut **__existing)?;
997 } else {
998 let mut __m = ::core::default::Default::default();
999 dec.merge_message(&mut __m)?;
1000 self.kind = ::core::option::Option::Some(
1001 __buffa::oneof::value::Kind::StructValue(
1002 ::buffa::alloc::boxed::Box::new(__m),
1003 ),
1004 );
1005 }
1006 }
1007 "list_value" => {
1008 if let ::core::option::Option::Some(
1009 __buffa::oneof::value::Kind::ListValue(ref mut __existing),
1010 ) = self.kind
1011 {
1012 dec.merge_message(&mut **__existing)?;
1013 } else {
1014 let mut __m = ::core::default::Default::default();
1015 dec.merge_message(&mut __m)?;
1016 self.kind = ::core::option::Option::Some(
1017 __buffa::oneof::value::Kind::ListValue(
1018 ::buffa::alloc::boxed::Box::new(__m),
1019 ),
1020 );
1021 }
1022 }
1023 _ => dec.skip_value()?,
1024 }
1025 }
1026 ::core::result::Result::Ok(())
1027 }
1028}
1029#[doc(hidden)]
1030pub const __VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1031 type_url: "type.googleapis.com/google.protobuf.Value",
1032 text_encode: ::buffa::type_registry::any_encode_text::<Value>,
1033 text_merge: ::buffa::type_registry::any_merge_text::<Value>,
1034};
1035pub mod value {
1036 #[allow(unused_imports)]
1037 use super::*;
1038 #[doc(inline)]
1039 pub use super::__buffa::oneof::value::Kind;
1040 #[doc(inline)]
1041 pub use super::__buffa::view::oneof::value::Kind as KindView;
1042}
1043#[derive(Clone, PartialEq, Default)]
1047#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1048pub struct ListValue {
1049 pub values: ::buffa::alloc::vec::Vec<Value>,
1053 #[doc(hidden)]
1054 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1055}
1056impl ::core::fmt::Debug for ListValue {
1057 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1058 f.debug_struct("ListValue").field("values", &self.values).finish()
1059 }
1060}
1061impl ListValue {
1062 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ListValue";
1067}
1068impl ::buffa::DefaultInstance for ListValue {
1069 fn default_instance() -> &'static Self {
1070 static VALUE: ::buffa::__private::OnceBox<ListValue> = ::buffa::__private::OnceBox::new();
1071 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1072 }
1073}
1074#[cfg(feature = "reflect")]
1075const _: () = {
1076 impl ::buffa_descriptor::reflect::ReflectMessage for ListValue {
1077 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1078 __buffa::reflect::descriptor_pool()
1079 .message(Self::__buffa_reflect_message_index())
1080 }
1081 fn pool(
1082 &self,
1083 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1084 __buffa::reflect::descriptor_pool()
1085 }
1086 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1087 &self.__buffa_unknown_fields
1088 }
1089 fn get(
1090 &self,
1091 field: &::buffa_descriptor::FieldDescriptor,
1092 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1093 #[allow(unused_imports)]
1094 use ::buffa::Enumeration as _;
1095 match field.number() {
1096 1u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.values),
1097 _ => {
1098 ::core::debug_assert!(
1099 false,
1100 "field number {} is not a member of this message's reflect get()",
1101 field.number(),
1102 );
1103 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1104 }
1105 }
1106 }
1107 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1108 match field.number() {
1109 1u32 => !self.values.is_empty(),
1110 _ => false,
1111 }
1112 }
1113 fn for_each_set(
1114 &self,
1115 f: &mut dyn ::core::ops::FnMut(
1116 &::buffa_descriptor::FieldDescriptor,
1117 ::buffa_descriptor::reflect::ValueRef<'_>,
1118 ),
1119 ) {
1120 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1121 self,
1122 );
1123 for fd in md.fields() {
1124 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1125 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1126 }
1127 }
1128 }
1129 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1130 ::buffa_descriptor::reflect::DynamicMessage::from_message(
1131 self,
1132 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
1133 Self::__buffa_reflect_message_index(),
1134 )
1135 }
1136 }
1137 impl ::buffa_descriptor::reflect::ReflectElement for ListValue {
1138 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1139 ::buffa_descriptor::reflect::ValueRef::Message(
1140 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1141 )
1142 }
1143 }
1144 impl ListValue {
1145 #[doc(hidden)]
1148 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1149 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1150 *IDX
1151 .get_or_init(|| {
1152 __buffa::reflect::descriptor_pool()
1153 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1154 .expect(
1155 "generated message is registered in the embedded descriptor pool",
1156 )
1157 })
1158 }
1159 }
1160 impl ::buffa_descriptor::reflect::Reflectable for ListValue {
1161 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
1165 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
1166 }
1167 }
1168};
1169impl ::buffa::MessageName for ListValue {
1170 const PACKAGE: &'static str = "google.protobuf";
1171 const NAME: &'static str = "ListValue";
1172 const FULL_NAME: &'static str = "google.protobuf.ListValue";
1173 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ListValue";
1174}
1175impl ::buffa::Message for ListValue {
1176 #[allow(clippy::let_and_return)]
1182 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1183 #[allow(unused_imports)]
1184 use ::buffa::Enumeration as _;
1185 let mut size = 0u32;
1186 for v in &self.values {
1187 let __slot = __cache.reserve();
1188 let inner_size = v.compute_size(__cache);
1189 __cache.set(__slot, inner_size);
1190 size
1191 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1192 + inner_size;
1193 }
1194 size += self.__buffa_unknown_fields.encoded_len() as u32;
1195 size
1196 }
1197 fn write_to(
1198 &self,
1199 __cache: &mut ::buffa::SizeCache,
1200 buf: &mut impl ::buffa::bytes::BufMut,
1201 ) {
1202 #[allow(unused_imports)]
1203 use ::buffa::Enumeration as _;
1204 for v in &self.values {
1205 ::buffa::encoding::Tag::new(
1206 1u32,
1207 ::buffa::encoding::WireType::LengthDelimited,
1208 )
1209 .encode(buf);
1210 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1211 v.write_to(__cache, buf);
1212 }
1213 self.__buffa_unknown_fields.write_to(buf);
1214 }
1215 fn merge_field(
1216 &mut self,
1217 tag: ::buffa::encoding::Tag,
1218 buf: &mut impl ::buffa::bytes::Buf,
1219 depth: u32,
1220 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1221 #[allow(unused_imports)]
1222 use ::buffa::bytes::Buf as _;
1223 #[allow(unused_imports)]
1224 use ::buffa::Enumeration as _;
1225 match tag.field_number() {
1226 1u32 => {
1227 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1228 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1229 field_number: 1u32,
1230 expected: 2u8,
1231 actual: tag.wire_type() as u8,
1232 });
1233 }
1234 let mut elem = ::core::default::Default::default();
1235 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1236 self.values.push(elem);
1237 }
1238 _ => {
1239 self.__buffa_unknown_fields
1240 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1241 }
1242 }
1243 ::core::result::Result::Ok(())
1244 }
1245 fn clear(&mut self) {
1246 self.values.clear();
1247 self.__buffa_unknown_fields.clear();
1248 }
1249}
1250impl ::buffa::ExtensionSet for ListValue {
1251 const PROTO_FQN: &'static str = "google.protobuf.ListValue";
1252 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1253 &self.__buffa_unknown_fields
1254 }
1255 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1256 &mut self.__buffa_unknown_fields
1257 }
1258}
1259impl ::buffa::text::TextFormat for ListValue {
1260 fn encode_text(
1261 &self,
1262 enc: &mut ::buffa::text::TextEncoder<'_>,
1263 ) -> ::core::fmt::Result {
1264 #[allow(unused_imports)]
1265 use ::buffa::Enumeration as _;
1266 for __v in &self.values {
1267 enc.write_field_name("values")?;
1268 enc.write_message(__v)?;
1269 }
1270 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1271 ::core::result::Result::Ok(())
1272 }
1273 fn merge_text(
1274 &mut self,
1275 dec: &mut ::buffa::text::TextDecoder<'_>,
1276 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1277 #[allow(unused_imports)]
1278 use ::buffa::Enumeration as _;
1279 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1280 match __name {
1281 "values" => {
1282 dec.read_repeated_into(
1283 &mut self.values,
1284 |__d| {
1285 let mut __m = ::core::default::Default::default();
1286 __d.merge_message(&mut __m)?;
1287 ::core::result::Result::Ok(__m)
1288 },
1289 )?
1290 }
1291 _ => dec.skip_value()?,
1292 }
1293 }
1294 ::core::result::Result::Ok(())
1295 }
1296}
1297#[doc(hidden)]
1298pub const __LIST_VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1299 type_url: "type.googleapis.com/google.protobuf.ListValue",
1300 text_encode: ::buffa::type_registry::any_encode_text::<ListValue>,
1301 text_merge: ::buffa::type_registry::any_merge_text::<ListValue>,
1302};