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 ::core::default::Default for NullValue {
16    fn default() -> Self {
17        Self::NULL_VALUE
18    }
19}
20impl ::buffa::Enumeration for NullValue {
21    fn from_i32(value: i32) -> ::core::option::Option<Self> {
22        match value {
23            0i32 => ::core::option::Option::Some(Self::NULL_VALUE),
24            _ => ::core::option::Option::None,
25        }
26    }
27    fn to_i32(&self) -> i32 {
28        *self as i32
29    }
30    fn proto_name(&self) -> &'static str {
31        match self {
32            Self::NULL_VALUE => "NULL_VALUE",
33        }
34    }
35    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
36        match name {
37            "NULL_VALUE" => ::core::option::Option::Some(Self::NULL_VALUE),
38            _ => ::core::option::Option::None,
39        }
40    }
41    fn values() -> &'static [Self] {
42        &[Self::NULL_VALUE]
43    }
44}
45/// `Struct` represents a structured data value, consisting of fields
46/// which map to dynamically typed values. In some languages, `Struct`
47/// might be supported by a native representation. For example, in
48/// scripting languages like JS a struct is represented as an
49/// object. The details of that representation are described together
50/// with the proto support for the language.
51///
52/// The JSON representation for `Struct` is JSON object.
53#[derive(Clone, PartialEq, Default)]
54#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
55pub struct Struct {
56    /// Unordered map of dynamically typed values.
57    ///
58    /// Field 1: `fields`
59    pub fields: ::buffa::__private::HashMap<::buffa::alloc::string::String, Value>,
60    #[doc(hidden)]
61    pub __buffa_unknown_fields: ::buffa::UnknownFields,
62}
63impl ::core::fmt::Debug for Struct {
64    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
65        f.debug_struct("Struct").field("fields", &self.fields).finish()
66    }
67}
68impl Struct {
69    /// Protobuf type URL for this message, for use with `Any::pack` and
70    /// `Any::unpack_if`.
71    ///
72    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
73    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Struct";
74}
75impl ::buffa::DefaultInstance for Struct {
76    fn default_instance() -> &'static Self {
77        static VALUE: ::buffa::__private::OnceBox<Struct> = ::buffa::__private::OnceBox::new();
78        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
79    }
80}
81impl ::buffa::Message for Struct {
82    /// Returns the total encoded size in bytes.
83    ///
84    /// The result is a `u32`; the protobuf specification requires all
85    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
86    /// compliant message will never overflow this type.
87    #[allow(clippy::let_and_return)]
88    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
89        #[allow(unused_imports)]
90        use ::buffa::Enumeration as _;
91        let mut size = 0u32;
92        #[allow(clippy::for_kv_map)]
93        for (k, v) in &self.fields {
94            let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
95                + 1u32
96                + {
97                    let __slot = __cache.reserve();
98                    let inner = v.compute_size(__cache);
99                    __cache.set(__slot, inner);
100                    ::buffa::encoding::varint_len(inner as u64) as u32 + inner
101                };
102            size
103                += 1u32 + ::buffa::encoding::varint_len(entry_size as u64) as u32
104                    + entry_size;
105        }
106        size += self.__buffa_unknown_fields.encoded_len() as u32;
107        size
108    }
109    fn write_to(
110        &self,
111        __cache: &mut ::buffa::SizeCache,
112        buf: &mut impl ::buffa::bytes::BufMut,
113    ) {
114        #[allow(unused_imports)]
115        use ::buffa::Enumeration as _;
116        for (k, v) in &self.fields {
117            let __v_len = __cache.consume_next();
118            let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
119                + 1u32
120                + (::buffa::encoding::varint_len(__v_len as u64) as u32 + __v_len);
121            ::buffa::encoding::Tag::new(
122                    1u32,
123                    ::buffa::encoding::WireType::LengthDelimited,
124                )
125                .encode(buf);
126            ::buffa::encoding::encode_varint(entry_size as u64, buf);
127            ::buffa::encoding::Tag::new(
128                    1u32,
129                    ::buffa::encoding::WireType::LengthDelimited,
130                )
131                .encode(buf);
132            ::buffa::types::encode_string(k, buf);
133            ::buffa::encoding::Tag::new(
134                    2u32,
135                    ::buffa::encoding::WireType::LengthDelimited,
136                )
137                .encode(buf);
138            ::buffa::encoding::encode_varint(__v_len as u64, buf);
139            v.write_to(__cache, buf);
140        }
141        self.__buffa_unknown_fields.write_to(buf);
142    }
143    fn merge_field(
144        &mut self,
145        tag: ::buffa::encoding::Tag,
146        buf: &mut impl ::buffa::bytes::Buf,
147        depth: u32,
148    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
149        #[allow(unused_imports)]
150        use ::buffa::bytes::Buf as _;
151        #[allow(unused_imports)]
152        use ::buffa::Enumeration as _;
153        match tag.field_number() {
154            1u32 => {
155                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
156                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
157                        field_number: 1u32,
158                        expected: 2u8,
159                        actual: tag.wire_type() as u8,
160                    });
161                }
162                let entry_len = ::buffa::encoding::decode_varint(buf)?;
163                let entry_len = usize::try_from(entry_len)
164                    .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
165                if buf.remaining() < entry_len {
166                    return ::core::result::Result::Err(
167                        ::buffa::DecodeError::UnexpectedEof,
168                    );
169                }
170                let entry_limit = buf.remaining() - entry_len;
171                let mut key = ::core::default::Default::default();
172                let mut val = ::core::default::Default::default();
173                while buf.remaining() > entry_limit {
174                    let entry_tag = ::buffa::encoding::Tag::decode(buf)?;
175                    match entry_tag.field_number() {
176                        1 => {
177                            if entry_tag.wire_type()
178                                != ::buffa::encoding::WireType::LengthDelimited
179                            {
180                                return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
181                                    field_number: entry_tag.field_number(),
182                                    expected: 2u8,
183                                    actual: entry_tag.wire_type() as u8,
184                                });
185                            }
186                            key = ::buffa::types::decode_string(buf)?;
187                        }
188                        2 => {
189                            if entry_tag.wire_type()
190                                != ::buffa::encoding::WireType::LengthDelimited
191                            {
192                                return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
193                                    field_number: entry_tag.field_number(),
194                                    expected: 2u8,
195                                    actual: entry_tag.wire_type() as u8,
196                                });
197                            }
198                            ::buffa::Message::merge_length_delimited(
199                                &mut val,
200                                buf,
201                                depth,
202                            )?;
203                        }
204                        _ => {
205                            ::buffa::encoding::skip_field_depth(entry_tag, buf, depth)?;
206                        }
207                    }
208                }
209                if buf.remaining() != entry_limit {
210                    let remaining = buf.remaining();
211                    if remaining > entry_limit {
212                        buf.advance(remaining - entry_limit);
213                    } else {
214                        return ::core::result::Result::Err(
215                            ::buffa::DecodeError::UnexpectedEof,
216                        );
217                    }
218                }
219                self.fields.insert(key, val);
220            }
221            _ => {
222                self.__buffa_unknown_fields
223                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
224            }
225        }
226        ::core::result::Result::Ok(())
227    }
228    fn clear(&mut self) {
229        self.fields.clear();
230        self.__buffa_unknown_fields.clear();
231    }
232}
233impl ::buffa::ExtensionSet for Struct {
234    const PROTO_FQN: &'static str = "google.protobuf.Struct";
235    fn unknown_fields(&self) -> &::buffa::UnknownFields {
236        &self.__buffa_unknown_fields
237    }
238    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
239        &mut self.__buffa_unknown_fields
240    }
241}
242impl ::buffa::text::TextFormat for Struct {
243    fn encode_text(
244        &self,
245        enc: &mut ::buffa::text::TextEncoder<'_>,
246    ) -> ::core::fmt::Result {
247        #[allow(unused_imports)]
248        use ::buffa::Enumeration as _;
249        for (__k, __v) in &self.fields {
250            enc.write_field_name("fields")?;
251            enc.write_map_entry(|enc| {
252                enc.write_field_name("key")?;
253                enc.write_string(__k)?;
254                enc.write_field_name("value")?;
255                enc.write_message(__v)?;
256                ::core::result::Result::Ok(())
257            })?;
258        }
259        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
260        ::core::result::Result::Ok(())
261    }
262    fn merge_text(
263        &mut self,
264        dec: &mut ::buffa::text::TextDecoder<'_>,
265    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
266        #[allow(unused_imports)]
267        use ::buffa::Enumeration as _;
268        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
269            match __name {
270                "fields" => {
271                    let mut __pairs: ::buffa::alloc::vec::Vec<_> = ::buffa::alloc::vec::Vec::new();
272                    dec.read_repeated_into(
273                        &mut __pairs,
274                        |__d| {
275                            let mut __k = ::core::option::Option::None;
276                            let mut __v = ::core::option::Option::None;
277                            __d.merge_map_entry(|__d| {
278                                while let ::core::option::Option::Some(__n) = __d
279                                    .read_field_name()?
280                                {
281                                    match __n {
282                                        "key" => {
283                                            __k = ::core::option::Option::Some(
284                                                __d.read_string()?.into_owned(),
285                                            );
286                                        }
287                                        "value" => {
288                                            __v = ::core::option::Option::Some({
289                                                let mut __m = ::core::default::Default::default();
290                                                __d.merge_message(&mut __m)?;
291                                                __m
292                                            });
293                                        }
294                                        _ => __d.skip_value()?,
295                                    }
296                                }
297                                ::core::result::Result::Ok(())
298                            })?;
299                            ::core::result::Result::Ok((
300                                __k.unwrap_or_default(),
301                                __v.unwrap_or_default(),
302                            ))
303                        },
304                    )?;
305                    for (__k, __v) in __pairs {
306                        self.fields.insert(__k, __v);
307                    }
308                }
309                _ => dec.skip_value()?,
310            }
311        }
312        ::core::result::Result::Ok(())
313    }
314}
315#[doc(hidden)]
316pub const __STRUCT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
317    type_url: "type.googleapis.com/google.protobuf.Struct",
318    text_encode: ::buffa::type_registry::any_encode_text::<Struct>,
319    text_merge: ::buffa::type_registry::any_merge_text::<Struct>,
320};
321/// `Value` represents a dynamically typed value which can be either
322/// null, a number, a string, a boolean, a recursive struct value, or a
323/// list of values. A producer of value is expected to set one of these
324/// variants. Absence of any variant indicates an error.
325///
326/// The JSON representation for `Value` is JSON value.
327#[derive(Clone, PartialEq, Default)]
328#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
329pub struct Value {
330    pub kind: ::core::option::Option<__buffa::oneof::value::Kind>,
331    #[doc(hidden)]
332    pub __buffa_unknown_fields: ::buffa::UnknownFields,
333}
334impl ::core::fmt::Debug for Value {
335    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
336        f.debug_struct("Value").field("kind", &self.kind).finish()
337    }
338}
339impl Value {
340    /// Protobuf type URL for this message, for use with `Any::pack` and
341    /// `Any::unpack_if`.
342    ///
343    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
344    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Value";
345}
346impl ::buffa::DefaultInstance for Value {
347    fn default_instance() -> &'static Self {
348        static VALUE: ::buffa::__private::OnceBox<Value> = ::buffa::__private::OnceBox::new();
349        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
350    }
351}
352impl ::buffa::Message for Value {
353    /// Returns the total encoded size in bytes.
354    ///
355    /// The result is a `u32`; the protobuf specification requires all
356    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
357    /// compliant message will never overflow this type.
358    #[allow(clippy::let_and_return)]
359    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
360        #[allow(unused_imports)]
361        use ::buffa::Enumeration as _;
362        let mut size = 0u32;
363        if let ::core::option::Option::Some(ref v) = self.kind {
364            match v {
365                __buffa::oneof::value::Kind::NullValue(x) => {
366                    size += 1u32 + ::buffa::types::int32_encoded_len(x.to_i32()) as u32;
367                }
368                __buffa::oneof::value::Kind::NumberValue(_x) => {
369                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
370                }
371                __buffa::oneof::value::Kind::StringValue(x) => {
372                    size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
373                }
374                __buffa::oneof::value::Kind::BoolValue(_x) => {
375                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
376                }
377                __buffa::oneof::value::Kind::StructValue(x) => {
378                    let __slot = __cache.reserve();
379                    let inner = x.compute_size(__cache);
380                    __cache.set(__slot, inner);
381                    size
382                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
383                            + inner;
384                }
385                __buffa::oneof::value::Kind::ListValue(x) => {
386                    let __slot = __cache.reserve();
387                    let inner = x.compute_size(__cache);
388                    __cache.set(__slot, inner);
389                    size
390                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
391                            + inner;
392                }
393            }
394        }
395        size += self.__buffa_unknown_fields.encoded_len() as u32;
396        size
397    }
398    fn write_to(
399        &self,
400        __cache: &mut ::buffa::SizeCache,
401        buf: &mut impl ::buffa::bytes::BufMut,
402    ) {
403        #[allow(unused_imports)]
404        use ::buffa::Enumeration as _;
405        if let ::core::option::Option::Some(ref v) = self.kind {
406            match v {
407                __buffa::oneof::value::Kind::NullValue(x) => {
408                    ::buffa::encoding::Tag::new(
409                            1u32,
410                            ::buffa::encoding::WireType::Varint,
411                        )
412                        .encode(buf);
413                    ::buffa::types::encode_int32(x.to_i32(), buf);
414                }
415                __buffa::oneof::value::Kind::NumberValue(x) => {
416                    ::buffa::encoding::Tag::new(
417                            2u32,
418                            ::buffa::encoding::WireType::Fixed64,
419                        )
420                        .encode(buf);
421                    ::buffa::types::encode_double(*x, buf);
422                }
423                __buffa::oneof::value::Kind::StringValue(x) => {
424                    ::buffa::encoding::Tag::new(
425                            3u32,
426                            ::buffa::encoding::WireType::LengthDelimited,
427                        )
428                        .encode(buf);
429                    ::buffa::types::encode_string(x, buf);
430                }
431                __buffa::oneof::value::Kind::BoolValue(x) => {
432                    ::buffa::encoding::Tag::new(
433                            4u32,
434                            ::buffa::encoding::WireType::Varint,
435                        )
436                        .encode(buf);
437                    ::buffa::types::encode_bool(*x, buf);
438                }
439                __buffa::oneof::value::Kind::StructValue(x) => {
440                    ::buffa::encoding::Tag::new(
441                            5u32,
442                            ::buffa::encoding::WireType::LengthDelimited,
443                        )
444                        .encode(buf);
445                    ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
446                    x.write_to(__cache, buf);
447                }
448                __buffa::oneof::value::Kind::ListValue(x) => {
449                    ::buffa::encoding::Tag::new(
450                            6u32,
451                            ::buffa::encoding::WireType::LengthDelimited,
452                        )
453                        .encode(buf);
454                    ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
455                    x.write_to(__cache, buf);
456                }
457            }
458        }
459        self.__buffa_unknown_fields.write_to(buf);
460    }
461    fn merge_field(
462        &mut self,
463        tag: ::buffa::encoding::Tag,
464        buf: &mut impl ::buffa::bytes::Buf,
465        depth: u32,
466    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
467        #[allow(unused_imports)]
468        use ::buffa::bytes::Buf as _;
469        #[allow(unused_imports)]
470        use ::buffa::Enumeration as _;
471        match tag.field_number() {
472            1u32 => {
473                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
474                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
475                        field_number: 1u32,
476                        expected: 0u8,
477                        actual: tag.wire_type() as u8,
478                    });
479                }
480                self.kind = ::core::option::Option::Some(
481                    __buffa::oneof::value::Kind::NullValue(
482                        ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
483                    ),
484                );
485            }
486            2u32 => {
487                if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
488                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
489                        field_number: 2u32,
490                        expected: 1u8,
491                        actual: tag.wire_type() as u8,
492                    });
493                }
494                self.kind = ::core::option::Option::Some(
495                    __buffa::oneof::value::Kind::NumberValue(
496                        ::buffa::types::decode_double(buf)?,
497                    ),
498                );
499            }
500            3u32 => {
501                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
502                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
503                        field_number: 3u32,
504                        expected: 2u8,
505                        actual: tag.wire_type() as u8,
506                    });
507                }
508                self.kind = ::core::option::Option::Some(
509                    __buffa::oneof::value::Kind::StringValue(
510                        ::buffa::types::decode_string(buf)?,
511                    ),
512                );
513            }
514            4u32 => {
515                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
516                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
517                        field_number: 4u32,
518                        expected: 0u8,
519                        actual: tag.wire_type() as u8,
520                    });
521                }
522                self.kind = ::core::option::Option::Some(
523                    __buffa::oneof::value::Kind::BoolValue(
524                        ::buffa::types::decode_bool(buf)?,
525                    ),
526                );
527            }
528            5u32 => {
529                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
530                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
531                        field_number: 5u32,
532                        expected: 2u8,
533                        actual: tag.wire_type() as u8,
534                    });
535                }
536                if let ::core::option::Option::Some(
537                    __buffa::oneof::value::Kind::StructValue(ref mut existing),
538                ) = self.kind
539                {
540                    ::buffa::Message::merge_length_delimited(
541                        &mut **existing,
542                        buf,
543                        depth,
544                    )?;
545                } else {
546                    let mut val = ::core::default::Default::default();
547                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
548                    self.kind = ::core::option::Option::Some(
549                        __buffa::oneof::value::Kind::StructValue(
550                            ::buffa::alloc::boxed::Box::new(val),
551                        ),
552                    );
553                }
554            }
555            6u32 => {
556                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
557                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
558                        field_number: 6u32,
559                        expected: 2u8,
560                        actual: tag.wire_type() as u8,
561                    });
562                }
563                if let ::core::option::Option::Some(
564                    __buffa::oneof::value::Kind::ListValue(ref mut existing),
565                ) = self.kind
566                {
567                    ::buffa::Message::merge_length_delimited(
568                        &mut **existing,
569                        buf,
570                        depth,
571                    )?;
572                } else {
573                    let mut val = ::core::default::Default::default();
574                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
575                    self.kind = ::core::option::Option::Some(
576                        __buffa::oneof::value::Kind::ListValue(
577                            ::buffa::alloc::boxed::Box::new(val),
578                        ),
579                    );
580                }
581            }
582            _ => {
583                self.__buffa_unknown_fields
584                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
585            }
586        }
587        ::core::result::Result::Ok(())
588    }
589    fn clear(&mut self) {
590        self.kind = ::core::option::Option::None;
591        self.__buffa_unknown_fields.clear();
592    }
593}
594impl ::buffa::ExtensionSet for Value {
595    const PROTO_FQN: &'static str = "google.protobuf.Value";
596    fn unknown_fields(&self) -> &::buffa::UnknownFields {
597        &self.__buffa_unknown_fields
598    }
599    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
600        &mut self.__buffa_unknown_fields
601    }
602}
603impl ::buffa::text::TextFormat for Value {
604    fn encode_text(
605        &self,
606        enc: &mut ::buffa::text::TextEncoder<'_>,
607    ) -> ::core::fmt::Result {
608        #[allow(unused_imports)]
609        use ::buffa::Enumeration as _;
610        if let ::core::option::Option::Some(ref __v) = self.kind {
611            match __v {
612                __buffa::oneof::value::Kind::NullValue(__v) => {
613                    enc.write_field_name("null_value")?;
614                    match __v {
615                        ::buffa::EnumValue::Known(__e) => {
616                            enc.write_enum_name(__e.proto_name())?
617                        }
618                        ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
619                    }
620                }
621                __buffa::oneof::value::Kind::NumberValue(__v) => {
622                    enc.write_field_name("number_value")?;
623                    enc.write_f64(*__v)?;
624                }
625                __buffa::oneof::value::Kind::StringValue(__v) => {
626                    enc.write_field_name("string_value")?;
627                    enc.write_string(__v)?;
628                }
629                __buffa::oneof::value::Kind::BoolValue(__v) => {
630                    enc.write_field_name("bool_value")?;
631                    enc.write_bool(*__v)?;
632                }
633                __buffa::oneof::value::Kind::StructValue(__v) => {
634                    enc.write_field_name("struct_value")?;
635                    enc.write_message(&**__v)?;
636                }
637                __buffa::oneof::value::Kind::ListValue(__v) => {
638                    enc.write_field_name("list_value")?;
639                    enc.write_message(&**__v)?;
640                }
641            }
642        }
643        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
644        ::core::result::Result::Ok(())
645    }
646    fn merge_text(
647        &mut self,
648        dec: &mut ::buffa::text::TextDecoder<'_>,
649    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
650        #[allow(unused_imports)]
651        use ::buffa::Enumeration as _;
652        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
653            match __name {
654                "null_value" => {
655                    self.kind = ::core::option::Option::Some(
656                        __buffa::oneof::value::Kind::NullValue(
657                            dec
658                                .read_enum_by_name::<NullValue>()
659                                .map(::buffa::EnumValue::from)?,
660                        ),
661                    );
662                }
663                "number_value" => {
664                    self.kind = ::core::option::Option::Some(
665                        __buffa::oneof::value::Kind::NumberValue(dec.read_f64()?),
666                    );
667                }
668                "string_value" => {
669                    self.kind = ::core::option::Option::Some(
670                        __buffa::oneof::value::Kind::StringValue(
671                            dec.read_string()?.into_owned(),
672                        ),
673                    );
674                }
675                "bool_value" => {
676                    self.kind = ::core::option::Option::Some(
677                        __buffa::oneof::value::Kind::BoolValue(dec.read_bool()?),
678                    );
679                }
680                "struct_value" => {
681                    if let ::core::option::Option::Some(
682                        __buffa::oneof::value::Kind::StructValue(ref mut __existing),
683                    ) = self.kind
684                    {
685                        dec.merge_message(&mut **__existing)?;
686                    } else {
687                        let mut __m = ::core::default::Default::default();
688                        dec.merge_message(&mut __m)?;
689                        self.kind = ::core::option::Option::Some(
690                            __buffa::oneof::value::Kind::StructValue(
691                                ::buffa::alloc::boxed::Box::new(__m),
692                            ),
693                        );
694                    }
695                }
696                "list_value" => {
697                    if let ::core::option::Option::Some(
698                        __buffa::oneof::value::Kind::ListValue(ref mut __existing),
699                    ) = self.kind
700                    {
701                        dec.merge_message(&mut **__existing)?;
702                    } else {
703                        let mut __m = ::core::default::Default::default();
704                        dec.merge_message(&mut __m)?;
705                        self.kind = ::core::option::Option::Some(
706                            __buffa::oneof::value::Kind::ListValue(
707                                ::buffa::alloc::boxed::Box::new(__m),
708                            ),
709                        );
710                    }
711                }
712                _ => dec.skip_value()?,
713            }
714        }
715        ::core::result::Result::Ok(())
716    }
717}
718#[doc(hidden)]
719pub const __VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
720    type_url: "type.googleapis.com/google.protobuf.Value",
721    text_encode: ::buffa::type_registry::any_encode_text::<Value>,
722    text_merge: ::buffa::type_registry::any_merge_text::<Value>,
723};
724/// `ListValue` is a wrapper around a repeated field of values.
725///
726/// The JSON representation for `ListValue` is JSON array.
727#[derive(Clone, PartialEq, Default)]
728#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
729pub struct ListValue {
730    /// Repeated field of dynamically typed values.
731    ///
732    /// Field 1: `values`
733    pub values: ::buffa::alloc::vec::Vec<Value>,
734    #[doc(hidden)]
735    pub __buffa_unknown_fields: ::buffa::UnknownFields,
736}
737impl ::core::fmt::Debug for ListValue {
738    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
739        f.debug_struct("ListValue").field("values", &self.values).finish()
740    }
741}
742impl ListValue {
743    /// Protobuf type URL for this message, for use with `Any::pack` and
744    /// `Any::unpack_if`.
745    ///
746    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
747    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ListValue";
748}
749impl ::buffa::DefaultInstance for ListValue {
750    fn default_instance() -> &'static Self {
751        static VALUE: ::buffa::__private::OnceBox<ListValue> = ::buffa::__private::OnceBox::new();
752        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
753    }
754}
755impl ::buffa::Message for ListValue {
756    /// Returns the total encoded size in bytes.
757    ///
758    /// The result is a `u32`; the protobuf specification requires all
759    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
760    /// compliant message will never overflow this type.
761    #[allow(clippy::let_and_return)]
762    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
763        #[allow(unused_imports)]
764        use ::buffa::Enumeration as _;
765        let mut size = 0u32;
766        for v in &self.values {
767            let __slot = __cache.reserve();
768            let inner_size = v.compute_size(__cache);
769            __cache.set(__slot, inner_size);
770            size
771                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
772                    + inner_size;
773        }
774        size += self.__buffa_unknown_fields.encoded_len() as u32;
775        size
776    }
777    fn write_to(
778        &self,
779        __cache: &mut ::buffa::SizeCache,
780        buf: &mut impl ::buffa::bytes::BufMut,
781    ) {
782        #[allow(unused_imports)]
783        use ::buffa::Enumeration as _;
784        for v in &self.values {
785            ::buffa::encoding::Tag::new(
786                    1u32,
787                    ::buffa::encoding::WireType::LengthDelimited,
788                )
789                .encode(buf);
790            ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
791            v.write_to(__cache, buf);
792        }
793        self.__buffa_unknown_fields.write_to(buf);
794    }
795    fn merge_field(
796        &mut self,
797        tag: ::buffa::encoding::Tag,
798        buf: &mut impl ::buffa::bytes::Buf,
799        depth: u32,
800    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
801        #[allow(unused_imports)]
802        use ::buffa::bytes::Buf as _;
803        #[allow(unused_imports)]
804        use ::buffa::Enumeration as _;
805        match tag.field_number() {
806            1u32 => {
807                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
808                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
809                        field_number: 1u32,
810                        expected: 2u8,
811                        actual: tag.wire_type() as u8,
812                    });
813                }
814                let mut elem = ::core::default::Default::default();
815                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
816                self.values.push(elem);
817            }
818            _ => {
819                self.__buffa_unknown_fields
820                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
821            }
822        }
823        ::core::result::Result::Ok(())
824    }
825    fn clear(&mut self) {
826        self.values.clear();
827        self.__buffa_unknown_fields.clear();
828    }
829}
830impl ::buffa::ExtensionSet for ListValue {
831    const PROTO_FQN: &'static str = "google.protobuf.ListValue";
832    fn unknown_fields(&self) -> &::buffa::UnknownFields {
833        &self.__buffa_unknown_fields
834    }
835    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
836        &mut self.__buffa_unknown_fields
837    }
838}
839impl ::buffa::text::TextFormat for ListValue {
840    fn encode_text(
841        &self,
842        enc: &mut ::buffa::text::TextEncoder<'_>,
843    ) -> ::core::fmt::Result {
844        #[allow(unused_imports)]
845        use ::buffa::Enumeration as _;
846        for __v in &self.values {
847            enc.write_field_name("values")?;
848            enc.write_message(__v)?;
849        }
850        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
851        ::core::result::Result::Ok(())
852    }
853    fn merge_text(
854        &mut self,
855        dec: &mut ::buffa::text::TextDecoder<'_>,
856    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
857        #[allow(unused_imports)]
858        use ::buffa::Enumeration as _;
859        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
860            match __name {
861                "values" => {
862                    dec.read_repeated_into(
863                        &mut self.values,
864                        |__d| {
865                            let mut __m = ::core::default::Default::default();
866                            __d.merge_message(&mut __m)?;
867                            ::core::result::Result::Ok(__m)
868                        },
869                    )?
870                }
871                _ => dec.skip_value()?,
872            }
873        }
874        ::core::result::Result::Ok(())
875    }
876}
877#[doc(hidden)]
878pub const __LIST_VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
879    type_url: "type.googleapis.com/google.protobuf.ListValue",
880    text_encode: ::buffa::type_registry::any_encode_text::<ListValue>,
881    text_merge: ::buffa::type_registry::any_merge_text::<ListValue>,
882};