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