Skip to main content

buffa_types/generated/
google.protobuf.struct.rs

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