Skip to main content

buffa_types/generated/
google.protobuf.struct.rs

1// @generated by protoc-gen-buffa. 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}
42/// `Struct` represents a structured data value, consisting of fields
43/// which map to dynamically typed values. In some languages, `Struct`
44/// might be supported by a native representation. For example, in
45/// scripting languages like JS a struct is represented as an
46/// object. The details of that representation are described together
47/// with the proto support for the language.
48///
49/// The JSON representation for `Struct` is JSON object.
50#[derive(Clone, PartialEq, Default)]
51#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
52pub struct Struct {
53    /// Unordered map of dynamically typed values.
54    ///
55    /// Field 1: `fields`
56    pub fields: ::buffa::__private::HashMap<::buffa::alloc::string::String, Value>,
57    #[doc(hidden)]
58    pub __buffa_unknown_fields: ::buffa::UnknownFields,
59    #[doc(hidden)]
60    pub __buffa_cached_size: ::buffa::__private::CachedSize,
61}
62impl ::core::fmt::Debug for Struct {
63    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
64        f.debug_struct("Struct").field("fields", &self.fields).finish()
65    }
66}
67impl Struct {
68    /// Protobuf type URL for this message, for use with `Any::pack` and
69    /// `Any::unpack_if`.
70    ///
71    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
72    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Struct";
73}
74unsafe impl ::buffa::DefaultInstance for Struct {
75    fn default_instance() -> &'static Self {
76        static VALUE: ::buffa::__private::OnceBox<Struct> = ::buffa::__private::OnceBox::new();
77        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
78    }
79}
80impl ::buffa::Message for Struct {
81    /// Returns the total encoded size in bytes.
82    ///
83    /// The result is a `u32`; the protobuf specification requires all
84    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
85    /// compliant message will never overflow this type.
86    fn compute_size(&self) -> u32 {
87        #[allow(unused_imports)]
88        use ::buffa::Enumeration as _;
89        let mut size = 0u32;
90        for (k, v) in &self.fields {
91            let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
92                + 1u32
93                + {
94                    let inner = v.compute_size();
95                    ::buffa::encoding::varint_len(inner as u64) as u32 + inner
96                };
97            size
98                += 1u32 + ::buffa::encoding::varint_len(entry_size as u64) as u32
99                    + entry_size;
100        }
101        size += self.__buffa_unknown_fields.encoded_len() as u32;
102        self.__buffa_cached_size.set(size);
103        size
104    }
105    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
106        #[allow(unused_imports)]
107        use ::buffa::Enumeration as _;
108        for (k, v) in &self.fields {
109            let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
110                + 1u32
111                + {
112                    let inner = v.compute_size();
113                    ::buffa::encoding::varint_len(inner as u64) as u32 + inner
114                };
115            ::buffa::encoding::Tag::new(
116                    1u32,
117                    ::buffa::encoding::WireType::LengthDelimited,
118                )
119                .encode(buf);
120            ::buffa::encoding::encode_varint(entry_size as u64, buf);
121            ::buffa::encoding::Tag::new(
122                    1u32,
123                    ::buffa::encoding::WireType::LengthDelimited,
124                )
125                .encode(buf);
126            ::buffa::types::encode_string(k, buf);
127            ::buffa::encoding::Tag::new(
128                    2u32,
129                    ::buffa::encoding::WireType::LengthDelimited,
130                )
131                .encode(buf);
132            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
133            v.write_to(buf);
134        }
135        self.__buffa_unknown_fields.write_to(buf);
136    }
137    fn merge_field(
138        &mut self,
139        tag: ::buffa::encoding::Tag,
140        buf: &mut impl ::buffa::bytes::Buf,
141        depth: u32,
142    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
143        #[allow(unused_imports)]
144        use ::buffa::bytes::Buf as _;
145        #[allow(unused_imports)]
146        use ::buffa::Enumeration as _;
147        match tag.field_number() {
148            1u32 => {
149                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
150                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
151                        field_number: 1u32,
152                        expected: 2u8,
153                        actual: tag.wire_type() as u8,
154                    });
155                }
156                let entry_len = ::buffa::encoding::decode_varint(buf)?;
157                let entry_len = usize::try_from(entry_len)
158                    .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
159                if buf.remaining() < entry_len {
160                    return ::core::result::Result::Err(
161                        ::buffa::DecodeError::UnexpectedEof,
162                    );
163                }
164                let entry_limit = buf.remaining() - entry_len;
165                let mut key = ::core::default::Default::default();
166                let mut val = ::core::default::Default::default();
167                while buf.remaining() > entry_limit {
168                    let entry_tag = ::buffa::encoding::Tag::decode(buf)?;
169                    match entry_tag.field_number() {
170                        1 => {
171                            if entry_tag.wire_type()
172                                != ::buffa::encoding::WireType::LengthDelimited
173                            {
174                                return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
175                                    field_number: entry_tag.field_number(),
176                                    expected: 2u8,
177                                    actual: entry_tag.wire_type() as u8,
178                                });
179                            }
180                            key = ::buffa::types::decode_string(buf)?;
181                        }
182                        2 => {
183                            if entry_tag.wire_type()
184                                != ::buffa::encoding::WireType::LengthDelimited
185                            {
186                                return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
187                                    field_number: entry_tag.field_number(),
188                                    expected: 2u8,
189                                    actual: entry_tag.wire_type() as u8,
190                                });
191                            }
192                            ::buffa::Message::merge_length_delimited(
193                                &mut val,
194                                buf,
195                                depth,
196                            )?;
197                        }
198                        _ => {
199                            ::buffa::encoding::skip_field_depth(entry_tag, buf, depth)?;
200                        }
201                    }
202                }
203                if buf.remaining() != entry_limit {
204                    let remaining = buf.remaining();
205                    if remaining > entry_limit {
206                        buf.advance(remaining - entry_limit);
207                    } else {
208                        return ::core::result::Result::Err(
209                            ::buffa::DecodeError::UnexpectedEof,
210                        );
211                    }
212                }
213                self.fields.insert(key, val);
214            }
215            _ => {
216                self.__buffa_unknown_fields
217                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
218            }
219        }
220        ::core::result::Result::Ok(())
221    }
222    fn cached_size(&self) -> u32 {
223        self.__buffa_cached_size.get()
224    }
225    fn clear(&mut self) {
226        self.fields.clear();
227        self.__buffa_unknown_fields.clear();
228        self.__buffa_cached_size.set(0);
229    }
230}
231impl ::buffa::ExtensionSet for Struct {
232    const PROTO_FQN: &'static str = "google.protobuf.Struct";
233    fn unknown_fields(&self) -> &::buffa::UnknownFields {
234        &self.__buffa_unknown_fields
235    }
236    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
237        &mut self.__buffa_unknown_fields
238    }
239}
240impl ::buffa::text::TextFormat for Struct {
241    fn encode_text(
242        &self,
243        enc: &mut ::buffa::text::TextEncoder<'_>,
244    ) -> ::core::fmt::Result {
245        #[allow(unused_imports)]
246        use ::buffa::Enumeration as _;
247        for (__k, __v) in &self.fields {
248            enc.write_field_name("fields")?;
249            enc.write_map_entry(|enc| {
250                enc.write_field_name("key")?;
251                enc.write_string(__k)?;
252                enc.write_field_name("value")?;
253                enc.write_message(__v)?;
254                ::core::result::Result::Ok(())
255            })?;
256        }
257        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
258        ::core::result::Result::Ok(())
259    }
260    fn merge_text(
261        &mut self,
262        dec: &mut ::buffa::text::TextDecoder<'_>,
263    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
264        #[allow(unused_imports)]
265        use ::buffa::Enumeration as _;
266        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
267            match __name {
268                "fields" => {
269                    let mut __pairs: ::buffa::alloc::vec::Vec<_> = ::buffa::alloc::vec::Vec::new();
270                    dec.read_repeated_into(
271                        &mut __pairs,
272                        |__d| {
273                            let mut __k = ::core::option::Option::None;
274                            let mut __v = ::core::option::Option::None;
275                            __d.merge_map_entry(|__d| {
276                                while let ::core::option::Option::Some(__n) = __d
277                                    .read_field_name()?
278                                {
279                                    match __n {
280                                        "key" => {
281                                            __k = ::core::option::Option::Some(
282                                                __d.read_string()?.into_owned(),
283                                            );
284                                        }
285                                        "value" => {
286                                            __v = ::core::option::Option::Some({
287                                                let mut __m = ::core::default::Default::default();
288                                                __d.merge_message(&mut __m)?;
289                                                __m
290                                            });
291                                        }
292                                        _ => __d.skip_value()?,
293                                    }
294                                }
295                                ::core::result::Result::Ok(())
296                            })?;
297                            ::core::result::Result::Ok((
298                                __k.unwrap_or_default(),
299                                __v.unwrap_or_default(),
300                            ))
301                        },
302                    )?;
303                    for (__k, __v) in __pairs {
304                        self.fields.insert(__k, __v);
305                    }
306                }
307                _ => dec.skip_value()?,
308            }
309        }
310        ::core::result::Result::Ok(())
311    }
312}
313#[doc(hidden)]
314pub const __STRUCT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
315    type_url: "type.googleapis.com/google.protobuf.Struct",
316    text_encode: ::buffa::type_registry::any_encode_text::<Struct>,
317    text_merge: ::buffa::type_registry::any_merge_text::<Struct>,
318};
319/// `Struct` represents a structured data value, consisting of fields
320/// which map to dynamically typed values. In some languages, `Struct`
321/// might be supported by a native representation. For example, in
322/// scripting languages like JS a struct is represented as an
323/// object. The details of that representation are described together
324/// with the proto support for the language.
325///
326/// The JSON representation for `Struct` is JSON object.
327#[derive(Clone, Debug, Default)]
328pub struct StructView<'a> {
329    /// Unordered map of dynamically typed values.
330    ///
331    /// Field 1: `fields` (map)
332    pub fields: ::buffa::MapView<'a, &'a str, ValueView<'a>>,
333    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
334}
335impl<'a> StructView<'a> {
336    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
337    ///
338    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
339    /// and by generated sub-message decode arms with `depth - 1`.
340    ///
341    /// **Not part of the public API.** Named with a leading underscore to
342    /// signal that it is for generated-code use only.
343    #[doc(hidden)]
344    pub fn _decode_depth(
345        buf: &'a [u8],
346        depth: u32,
347    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
348        let mut view = Self::default();
349        view._merge_into_view(buf, depth)?;
350        ::core::result::Result::Ok(view)
351    }
352    /// Merge fields from `buf` into this view (proto merge semantics).
353    ///
354    /// Repeated fields append; singular fields last-wins; singular
355    /// MESSAGE fields merge recursively. Used by sub-message decode
356    /// arms when the same field appears multiple times on the wire.
357    ///
358    /// **Not part of the public API.**
359    #[doc(hidden)]
360    pub fn _merge_into_view(
361        &mut self,
362        buf: &'a [u8],
363        depth: u32,
364    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
365        let _ = depth;
366        #[allow(unused_variables)]
367        let view = self;
368        let mut cur: &'a [u8] = buf;
369        while !cur.is_empty() {
370            let before_tag = cur;
371            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
372            match tag.field_number() {
373                1u32 => {
374                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
375                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
376                            field_number: 1u32,
377                            expected: 2u8,
378                            actual: tag.wire_type() as u8,
379                        });
380                    }
381                    let entry_bytes = ::buffa::types::borrow_bytes(&mut cur)?;
382                    let mut entry_cur: &'a [u8] = entry_bytes;
383                    let mut key = "";
384                    let mut val = ::core::default::Default::default();
385                    while !entry_cur.is_empty() {
386                        let entry_tag = ::buffa::encoding::Tag::decode(&mut entry_cur)?;
387                        match entry_tag.field_number() {
388                            1 => {
389                                if entry_tag.wire_type()
390                                    != ::buffa::encoding::WireType::LengthDelimited
391                                {
392                                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
393                                        field_number: entry_tag.field_number(),
394                                        expected: 2u8,
395                                        actual: entry_tag.wire_type() as u8,
396                                    });
397                                }
398                                key = ::buffa::types::borrow_str(&mut entry_cur)?;
399                            }
400                            2 => {
401                                if entry_tag.wire_type()
402                                    != ::buffa::encoding::WireType::LengthDelimited
403                                {
404                                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
405                                        field_number: entry_tag.field_number(),
406                                        expected: 2u8,
407                                        actual: entry_tag.wire_type() as u8,
408                                    });
409                                }
410                                if depth == 0 {
411                                    return Err(::buffa::DecodeError::RecursionLimitExceeded);
412                                }
413                                let sub = ::buffa::types::borrow_bytes(&mut entry_cur)?;
414                                val = ValueView::_decode_depth(sub, depth - 1)?;
415                            }
416                            _ => {
417                                ::buffa::encoding::skip_field_depth(
418                                    entry_tag,
419                                    &mut entry_cur,
420                                    depth,
421                                )?;
422                            }
423                        }
424                    }
425                    view.fields.push(key, val);
426                }
427                _ => {
428                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
429                    let span_len = before_tag.len() - cur.len();
430                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
431                }
432            }
433        }
434        ::core::result::Result::Ok(())
435    }
436}
437impl<'a> ::buffa::MessageView<'a> for StructView<'a> {
438    type Owned = Struct;
439    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
440        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
441    }
442    fn decode_view_with_limit(
443        buf: &'a [u8],
444        depth: u32,
445    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
446        Self::_decode_depth(buf, depth)
447    }
448    /// Convert this view to the owned message type.
449    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
450    fn to_owned_message(&self) -> Struct {
451        #[allow(unused_imports)]
452        use ::buffa::alloc::string::ToString as _;
453        Struct {
454            fields: self
455                .fields
456                .iter()
457                .map(|(k, v)| (k.to_string(), v.to_owned_message()))
458                .collect(),
459            __buffa_unknown_fields: self
460                .__buffa_unknown_fields
461                .to_owned()
462                .unwrap_or_default()
463                .into(),
464            ..::core::default::Default::default()
465        }
466    }
467}
468unsafe impl ::buffa::DefaultViewInstance for StructView<'static> {
469    fn default_view_instance() -> &'static Self {
470        static VALUE: ::buffa::__private::OnceBox<StructView<'static>> = ::buffa::__private::OnceBox::new();
471        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
472    }
473}
474unsafe impl<'a> ::buffa::HasDefaultViewInstance for StructView<'a> {
475    type Static = StructView<'static>;
476}
477/// `Value` represents a dynamically typed value which can be either
478/// null, a number, a string, a boolean, a recursive struct value, or a
479/// list of values. A producer of value is expected to set one of these
480/// variants. Absence of any variant indicates an error.
481///
482/// The JSON representation for `Value` is JSON value.
483#[derive(Clone, PartialEq, Default)]
484#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
485pub struct Value {
486    pub kind: Option<value::Kind>,
487    #[doc(hidden)]
488    pub __buffa_unknown_fields: ::buffa::UnknownFields,
489    #[doc(hidden)]
490    pub __buffa_cached_size: ::buffa::__private::CachedSize,
491}
492impl ::core::fmt::Debug for Value {
493    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
494        f.debug_struct("Value").field("kind", &self.kind).finish()
495    }
496}
497impl Value {
498    /// Protobuf type URL for this message, for use with `Any::pack` and
499    /// `Any::unpack_if`.
500    ///
501    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
502    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Value";
503}
504unsafe impl ::buffa::DefaultInstance for Value {
505    fn default_instance() -> &'static Self {
506        static VALUE: ::buffa::__private::OnceBox<Value> = ::buffa::__private::OnceBox::new();
507        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
508    }
509}
510impl ::buffa::Message for Value {
511    /// Returns the total encoded size in bytes.
512    ///
513    /// The result is a `u32`; the protobuf specification requires all
514    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
515    /// compliant message will never overflow this type.
516    fn compute_size(&self) -> u32 {
517        #[allow(unused_imports)]
518        use ::buffa::Enumeration as _;
519        let mut size = 0u32;
520        if let ::core::option::Option::Some(ref v) = self.kind {
521            match v {
522                value::Kind::NullValue(x) => {
523                    size += 1u32 + ::buffa::types::int32_encoded_len(x.to_i32()) as u32;
524                }
525                value::Kind::NumberValue(_x) => {
526                    size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
527                }
528                value::Kind::StringValue(x) => {
529                    size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
530                }
531                value::Kind::BoolValue(_x) => {
532                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
533                }
534                value::Kind::StructValue(x) => {
535                    let inner = x.compute_size();
536                    size
537                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
538                            + inner;
539                }
540                value::Kind::ListValue(x) => {
541                    let inner = x.compute_size();
542                    size
543                        += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
544                            + inner;
545                }
546            }
547        }
548        size += self.__buffa_unknown_fields.encoded_len() as u32;
549        self.__buffa_cached_size.set(size);
550        size
551    }
552    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
553        #[allow(unused_imports)]
554        use ::buffa::Enumeration as _;
555        if let ::core::option::Option::Some(ref v) = self.kind {
556            match v {
557                value::Kind::NullValue(x) => {
558                    ::buffa::encoding::Tag::new(
559                            1u32,
560                            ::buffa::encoding::WireType::Varint,
561                        )
562                        .encode(buf);
563                    ::buffa::types::encode_int32(x.to_i32(), buf);
564                }
565                value::Kind::NumberValue(x) => {
566                    ::buffa::encoding::Tag::new(
567                            2u32,
568                            ::buffa::encoding::WireType::Fixed64,
569                        )
570                        .encode(buf);
571                    ::buffa::types::encode_double(*x, buf);
572                }
573                value::Kind::StringValue(x) => {
574                    ::buffa::encoding::Tag::new(
575                            3u32,
576                            ::buffa::encoding::WireType::LengthDelimited,
577                        )
578                        .encode(buf);
579                    ::buffa::types::encode_string(x, buf);
580                }
581                value::Kind::BoolValue(x) => {
582                    ::buffa::encoding::Tag::new(
583                            4u32,
584                            ::buffa::encoding::WireType::Varint,
585                        )
586                        .encode(buf);
587                    ::buffa::types::encode_bool(*x, buf);
588                }
589                value::Kind::StructValue(x) => {
590                    ::buffa::encoding::Tag::new(
591                            5u32,
592                            ::buffa::encoding::WireType::LengthDelimited,
593                        )
594                        .encode(buf);
595                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
596                    x.write_to(buf);
597                }
598                value::Kind::ListValue(x) => {
599                    ::buffa::encoding::Tag::new(
600                            6u32,
601                            ::buffa::encoding::WireType::LengthDelimited,
602                        )
603                        .encode(buf);
604                    ::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
605                    x.write_to(buf);
606                }
607            }
608        }
609        self.__buffa_unknown_fields.write_to(buf);
610    }
611    fn merge_field(
612        &mut self,
613        tag: ::buffa::encoding::Tag,
614        buf: &mut impl ::buffa::bytes::Buf,
615        depth: u32,
616    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
617        #[allow(unused_imports)]
618        use ::buffa::bytes::Buf as _;
619        #[allow(unused_imports)]
620        use ::buffa::Enumeration as _;
621        match tag.field_number() {
622            1u32 => {
623                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
624                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
625                        field_number: 1u32,
626                        expected: 0u8,
627                        actual: tag.wire_type() as u8,
628                    });
629                }
630                self.kind = ::core::option::Option::Some(
631                    value::Kind::NullValue(
632                        ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?),
633                    ),
634                );
635            }
636            2u32 => {
637                if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
638                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
639                        field_number: 2u32,
640                        expected: 1u8,
641                        actual: tag.wire_type() as u8,
642                    });
643                }
644                self.kind = ::core::option::Option::Some(
645                    value::Kind::NumberValue(::buffa::types::decode_double(buf)?),
646                );
647            }
648            3u32 => {
649                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
650                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
651                        field_number: 3u32,
652                        expected: 2u8,
653                        actual: tag.wire_type() as u8,
654                    });
655                }
656                self.kind = ::core::option::Option::Some(
657                    value::Kind::StringValue(::buffa::types::decode_string(buf)?),
658                );
659            }
660            4u32 => {
661                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
662                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
663                        field_number: 4u32,
664                        expected: 0u8,
665                        actual: tag.wire_type() as u8,
666                    });
667                }
668                self.kind = ::core::option::Option::Some(
669                    value::Kind::BoolValue(::buffa::types::decode_bool(buf)?),
670                );
671            }
672            5u32 => {
673                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
674                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
675                        field_number: 5u32,
676                        expected: 2u8,
677                        actual: tag.wire_type() as u8,
678                    });
679                }
680                if let ::core::option::Option::Some(
681                    value::Kind::StructValue(ref mut existing),
682                ) = self.kind
683                {
684                    ::buffa::Message::merge_length_delimited(
685                        &mut **existing,
686                        buf,
687                        depth,
688                    )?;
689                } else {
690                    let mut val = ::core::default::Default::default();
691                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
692                    self.kind = ::core::option::Option::Some(
693                        value::Kind::StructValue(::buffa::alloc::boxed::Box::new(val)),
694                    );
695                }
696            }
697            6u32 => {
698                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
699                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
700                        field_number: 6u32,
701                        expected: 2u8,
702                        actual: tag.wire_type() as u8,
703                    });
704                }
705                if let ::core::option::Option::Some(
706                    value::Kind::ListValue(ref mut existing),
707                ) = self.kind
708                {
709                    ::buffa::Message::merge_length_delimited(
710                        &mut **existing,
711                        buf,
712                        depth,
713                    )?;
714                } else {
715                    let mut val = ::core::default::Default::default();
716                    ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
717                    self.kind = ::core::option::Option::Some(
718                        value::Kind::ListValue(::buffa::alloc::boxed::Box::new(val)),
719                    );
720                }
721            }
722            _ => {
723                self.__buffa_unknown_fields
724                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
725            }
726        }
727        ::core::result::Result::Ok(())
728    }
729    fn cached_size(&self) -> u32 {
730        self.__buffa_cached_size.get()
731    }
732    fn clear(&mut self) {
733        self.kind = ::core::option::Option::None;
734        self.__buffa_unknown_fields.clear();
735        self.__buffa_cached_size.set(0);
736    }
737}
738impl ::buffa::ExtensionSet for Value {
739    const PROTO_FQN: &'static str = "google.protobuf.Value";
740    fn unknown_fields(&self) -> &::buffa::UnknownFields {
741        &self.__buffa_unknown_fields
742    }
743    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
744        &mut self.__buffa_unknown_fields
745    }
746}
747impl ::buffa::text::TextFormat for Value {
748    fn encode_text(
749        &self,
750        enc: &mut ::buffa::text::TextEncoder<'_>,
751    ) -> ::core::fmt::Result {
752        #[allow(unused_imports)]
753        use ::buffa::Enumeration as _;
754        if let ::core::option::Option::Some(ref __v) = self.kind {
755            match __v {
756                value::Kind::NullValue(__v) => {
757                    enc.write_field_name("null_value")?;
758                    match __v {
759                        ::buffa::EnumValue::Known(__e) => {
760                            enc.write_enum_name(__e.proto_name())?
761                        }
762                        ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
763                    }
764                }
765                value::Kind::NumberValue(__v) => {
766                    enc.write_field_name("number_value")?;
767                    enc.write_f64(*__v)?;
768                }
769                value::Kind::StringValue(__v) => {
770                    enc.write_field_name("string_value")?;
771                    enc.write_string(__v)?;
772                }
773                value::Kind::BoolValue(__v) => {
774                    enc.write_field_name("bool_value")?;
775                    enc.write_bool(*__v)?;
776                }
777                value::Kind::StructValue(__v) => {
778                    enc.write_field_name("struct_value")?;
779                    enc.write_message(&**__v)?;
780                }
781                value::Kind::ListValue(__v) => {
782                    enc.write_field_name("list_value")?;
783                    enc.write_message(&**__v)?;
784                }
785            }
786        }
787        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
788        ::core::result::Result::Ok(())
789    }
790    fn merge_text(
791        &mut self,
792        dec: &mut ::buffa::text::TextDecoder<'_>,
793    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
794        #[allow(unused_imports)]
795        use ::buffa::Enumeration as _;
796        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
797            match __name {
798                "null_value" => {
799                    self.kind = ::core::option::Option::Some(
800                        value::Kind::NullValue(
801                            dec
802                                .read_enum_by_name::<NullValue>()
803                                .map(::buffa::EnumValue::from)?,
804                        ),
805                    );
806                }
807                "number_value" => {
808                    self.kind = ::core::option::Option::Some(
809                        value::Kind::NumberValue(dec.read_f64()?),
810                    );
811                }
812                "string_value" => {
813                    self.kind = ::core::option::Option::Some(
814                        value::Kind::StringValue(dec.read_string()?.into_owned()),
815                    );
816                }
817                "bool_value" => {
818                    self.kind = ::core::option::Option::Some(
819                        value::Kind::BoolValue(dec.read_bool()?),
820                    );
821                }
822                "struct_value" => {
823                    if let ::core::option::Option::Some(
824                        value::Kind::StructValue(ref mut __existing),
825                    ) = self.kind
826                    {
827                        dec.merge_message(&mut **__existing)?;
828                    } else {
829                        let mut __m = ::core::default::Default::default();
830                        dec.merge_message(&mut __m)?;
831                        self.kind = ::core::option::Option::Some(
832                            value::Kind::StructValue(
833                                ::buffa::alloc::boxed::Box::new(__m),
834                            ),
835                        );
836                    }
837                }
838                "list_value" => {
839                    if let ::core::option::Option::Some(
840                        value::Kind::ListValue(ref mut __existing),
841                    ) = self.kind
842                    {
843                        dec.merge_message(&mut **__existing)?;
844                    } else {
845                        let mut __m = ::core::default::Default::default();
846                        dec.merge_message(&mut __m)?;
847                        self.kind = ::core::option::Option::Some(
848                            value::Kind::ListValue(::buffa::alloc::boxed::Box::new(__m)),
849                        );
850                    }
851                }
852                _ => dec.skip_value()?,
853            }
854        }
855        ::core::result::Result::Ok(())
856    }
857}
858#[doc(hidden)]
859pub const __VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
860    type_url: "type.googleapis.com/google.protobuf.Value",
861    text_encode: ::buffa::type_registry::any_encode_text::<Value>,
862    text_merge: ::buffa::type_registry::any_merge_text::<Value>,
863};
864/// `Value` represents a dynamically typed value which can be either
865/// null, a number, a string, a boolean, a recursive struct value, or a
866/// list of values. A producer of value is expected to set one of these
867/// variants. Absence of any variant indicates an error.
868///
869/// The JSON representation for `Value` is JSON value.
870#[derive(Clone, Debug, Default)]
871pub struct ValueView<'a> {
872    pub kind: ::core::option::Option<value::KindView<'a>>,
873    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
874}
875impl<'a> ValueView<'a> {
876    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
877    ///
878    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
879    /// and by generated sub-message decode arms with `depth - 1`.
880    ///
881    /// **Not part of the public API.** Named with a leading underscore to
882    /// signal that it is for generated-code use only.
883    #[doc(hidden)]
884    pub fn _decode_depth(
885        buf: &'a [u8],
886        depth: u32,
887    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
888        let mut view = Self::default();
889        view._merge_into_view(buf, depth)?;
890        ::core::result::Result::Ok(view)
891    }
892    /// Merge fields from `buf` into this view (proto merge semantics).
893    ///
894    /// Repeated fields append; singular fields last-wins; singular
895    /// MESSAGE fields merge recursively. Used by sub-message decode
896    /// arms when the same field appears multiple times on the wire.
897    ///
898    /// **Not part of the public API.**
899    #[doc(hidden)]
900    pub fn _merge_into_view(
901        &mut self,
902        buf: &'a [u8],
903        depth: u32,
904    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
905        let _ = depth;
906        #[allow(unused_variables)]
907        let view = self;
908        let mut cur: &'a [u8] = buf;
909        while !cur.is_empty() {
910            let before_tag = cur;
911            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
912            match tag.field_number() {
913                1u32 => {
914                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
915                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
916                            field_number: 1u32,
917                            expected: 0u8,
918                            actual: tag.wire_type() as u8,
919                        });
920                    }
921                    view.kind = Some(
922                        value::KindView::NullValue(
923                            ::buffa::EnumValue::from(
924                                ::buffa::types::decode_int32(&mut cur)?,
925                            ),
926                        ),
927                    );
928                }
929                2u32 => {
930                    if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
931                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
932                            field_number: 2u32,
933                            expected: 1u8,
934                            actual: tag.wire_type() as u8,
935                        });
936                    }
937                    view.kind = Some(
938                        value::KindView::NumberValue(
939                            ::buffa::types::decode_double(&mut cur)?,
940                        ),
941                    );
942                }
943                3u32 => {
944                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
945                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
946                            field_number: 3u32,
947                            expected: 2u8,
948                            actual: tag.wire_type() as u8,
949                        });
950                    }
951                    view.kind = Some(
952                        value::KindView::StringValue(
953                            ::buffa::types::borrow_str(&mut cur)?,
954                        ),
955                    );
956                }
957                4u32 => {
958                    if tag.wire_type() != ::buffa::encoding::WireType::Varint {
959                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
960                            field_number: 4u32,
961                            expected: 0u8,
962                            actual: tag.wire_type() as u8,
963                        });
964                    }
965                    view.kind = Some(
966                        value::KindView::BoolValue(
967                            ::buffa::types::decode_bool(&mut cur)?,
968                        ),
969                    );
970                }
971                5u32 => {
972                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
973                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
974                            field_number: 5u32,
975                            expected: 2u8,
976                            actual: tag.wire_type() as u8,
977                        });
978                    }
979                    if depth == 0 {
980                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
981                    }
982                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
983                    if let Some(value::KindView::StructValue(ref mut existing)) = view
984                        .kind
985                    {
986                        existing._merge_into_view(sub, depth - 1)?;
987                    } else {
988                        view.kind = Some(
989                            value::KindView::StructValue(
990                                ::buffa::alloc::boxed::Box::new(
991                                    StructView::_decode_depth(sub, depth - 1)?,
992                                ),
993                            ),
994                        );
995                    }
996                }
997                6u32 => {
998                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
999                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1000                            field_number: 6u32,
1001                            expected: 2u8,
1002                            actual: tag.wire_type() as u8,
1003                        });
1004                    }
1005                    if depth == 0 {
1006                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
1007                    }
1008                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1009                    if let Some(value::KindView::ListValue(ref mut existing)) = view.kind
1010                    {
1011                        existing._merge_into_view(sub, depth - 1)?;
1012                    } else {
1013                        view.kind = Some(
1014                            value::KindView::ListValue(
1015                                ::buffa::alloc::boxed::Box::new(
1016                                    ListValueView::_decode_depth(sub, depth - 1)?,
1017                                ),
1018                            ),
1019                        );
1020                    }
1021                }
1022                _ => {
1023                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1024                    let span_len = before_tag.len() - cur.len();
1025                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1026                }
1027            }
1028        }
1029        ::core::result::Result::Ok(())
1030    }
1031}
1032impl<'a> ::buffa::MessageView<'a> for ValueView<'a> {
1033    type Owned = Value;
1034    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1035        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1036    }
1037    fn decode_view_with_limit(
1038        buf: &'a [u8],
1039        depth: u32,
1040    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1041        Self::_decode_depth(buf, depth)
1042    }
1043    /// Convert this view to the owned message type.
1044    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
1045    fn to_owned_message(&self) -> Value {
1046        #[allow(unused_imports)]
1047        use ::buffa::alloc::string::ToString as _;
1048        Value {
1049            kind: self
1050                .kind
1051                .as_ref()
1052                .map(|v| match v {
1053                    value::KindView::NullValue(v) => value::Kind::NullValue(*v),
1054                    value::KindView::NumberValue(v) => value::Kind::NumberValue(*v),
1055                    value::KindView::StringValue(v) => {
1056                        value::Kind::StringValue(v.to_string())
1057                    }
1058                    value::KindView::BoolValue(v) => value::Kind::BoolValue(*v),
1059                    value::KindView::StructValue(v) => {
1060                        value::Kind::StructValue(
1061                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
1062                        )
1063                    }
1064                    value::KindView::ListValue(v) => {
1065                        value::Kind::ListValue(
1066                            ::buffa::alloc::boxed::Box::new(v.to_owned_message()),
1067                        )
1068                    }
1069                }),
1070            __buffa_unknown_fields: self
1071                .__buffa_unknown_fields
1072                .to_owned()
1073                .unwrap_or_default()
1074                .into(),
1075            ..::core::default::Default::default()
1076        }
1077    }
1078}
1079unsafe impl ::buffa::DefaultViewInstance for ValueView<'static> {
1080    fn default_view_instance() -> &'static Self {
1081        static VALUE: ::buffa::__private::OnceBox<ValueView<'static>> = ::buffa::__private::OnceBox::new();
1082        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1083    }
1084}
1085unsafe impl<'a> ::buffa::HasDefaultViewInstance for ValueView<'a> {
1086    type Static = ValueView<'static>;
1087}
1088pub mod value {
1089    #[allow(unused_imports)]
1090    use super::*;
1091    /// The kind of value.
1092    #[derive(Clone, PartialEq, Debug)]
1093    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1094    pub enum Kind {
1095        NullValue(::buffa::EnumValue<super::NullValue>),
1096        NumberValue(f64),
1097        StringValue(::buffa::alloc::string::String),
1098        BoolValue(bool),
1099        StructValue(::buffa::alloc::boxed::Box<super::Struct>),
1100        ListValue(::buffa::alloc::boxed::Box<super::ListValue>),
1101    }
1102    impl ::buffa::Oneof for Kind {}
1103    impl From<super::Struct> for Kind {
1104        fn from(v: super::Struct) -> Self {
1105            Self::StructValue(::buffa::alloc::boxed::Box::new(v))
1106        }
1107    }
1108    impl From<super::Struct> for ::core::option::Option<Kind> {
1109        fn from(v: super::Struct) -> Self {
1110            Self::Some(Kind::from(v))
1111        }
1112    }
1113    impl From<super::ListValue> for Kind {
1114        fn from(v: super::ListValue) -> Self {
1115            Self::ListValue(::buffa::alloc::boxed::Box::new(v))
1116        }
1117    }
1118    impl From<super::ListValue> for ::core::option::Option<Kind> {
1119        fn from(v: super::ListValue) -> Self {
1120            Self::Some(Kind::from(v))
1121        }
1122    }
1123    #[derive(Clone, Debug)]
1124    pub enum KindView<'a> {
1125        NullValue(::buffa::EnumValue<super::NullValue>),
1126        NumberValue(f64),
1127        StringValue(&'a str),
1128        BoolValue(bool),
1129        StructValue(::buffa::alloc::boxed::Box<super::StructView<'a>>),
1130        ListValue(::buffa::alloc::boxed::Box<super::ListValueView<'a>>),
1131    }
1132}
1133/// `ListValue` is a wrapper around a repeated field of values.
1134///
1135/// The JSON representation for `ListValue` is JSON array.
1136#[derive(Clone, PartialEq, Default)]
1137#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1138pub struct ListValue {
1139    /// Repeated field of dynamically typed values.
1140    ///
1141    /// Field 1: `values`
1142    pub values: ::buffa::alloc::vec::Vec<Value>,
1143    #[doc(hidden)]
1144    pub __buffa_unknown_fields: ::buffa::UnknownFields,
1145    #[doc(hidden)]
1146    pub __buffa_cached_size: ::buffa::__private::CachedSize,
1147}
1148impl ::core::fmt::Debug for ListValue {
1149    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1150        f.debug_struct("ListValue").field("values", &self.values).finish()
1151    }
1152}
1153impl ListValue {
1154    /// Protobuf type URL for this message, for use with `Any::pack` and
1155    /// `Any::unpack_if`.
1156    ///
1157    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1158    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ListValue";
1159}
1160unsafe impl ::buffa::DefaultInstance for ListValue {
1161    fn default_instance() -> &'static Self {
1162        static VALUE: ::buffa::__private::OnceBox<ListValue> = ::buffa::__private::OnceBox::new();
1163        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1164    }
1165}
1166impl ::buffa::Message for ListValue {
1167    /// Returns the total encoded size in bytes.
1168    ///
1169    /// The result is a `u32`; the protobuf specification requires all
1170    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
1171    /// compliant message will never overflow this type.
1172    fn compute_size(&self) -> u32 {
1173        #[allow(unused_imports)]
1174        use ::buffa::Enumeration as _;
1175        let mut size = 0u32;
1176        for v in &self.values {
1177            let inner_size = v.compute_size();
1178            size
1179                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1180                    + inner_size;
1181        }
1182        size += self.__buffa_unknown_fields.encoded_len() as u32;
1183        self.__buffa_cached_size.set(size);
1184        size
1185    }
1186    fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
1187        #[allow(unused_imports)]
1188        use ::buffa::Enumeration as _;
1189        for v in &self.values {
1190            ::buffa::encoding::Tag::new(
1191                    1u32,
1192                    ::buffa::encoding::WireType::LengthDelimited,
1193                )
1194                .encode(buf);
1195            ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
1196            v.write_to(buf);
1197        }
1198        self.__buffa_unknown_fields.write_to(buf);
1199    }
1200    fn merge_field(
1201        &mut self,
1202        tag: ::buffa::encoding::Tag,
1203        buf: &mut impl ::buffa::bytes::Buf,
1204        depth: u32,
1205    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1206        #[allow(unused_imports)]
1207        use ::buffa::bytes::Buf as _;
1208        #[allow(unused_imports)]
1209        use ::buffa::Enumeration as _;
1210        match tag.field_number() {
1211            1u32 => {
1212                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1213                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1214                        field_number: 1u32,
1215                        expected: 2u8,
1216                        actual: tag.wire_type() as u8,
1217                    });
1218                }
1219                let mut elem = ::core::default::Default::default();
1220                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1221                self.values.push(elem);
1222            }
1223            _ => {
1224                self.__buffa_unknown_fields
1225                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1226            }
1227        }
1228        ::core::result::Result::Ok(())
1229    }
1230    fn cached_size(&self) -> u32 {
1231        self.__buffa_cached_size.get()
1232    }
1233    fn clear(&mut self) {
1234        self.values.clear();
1235        self.__buffa_unknown_fields.clear();
1236        self.__buffa_cached_size.set(0);
1237    }
1238}
1239impl ::buffa::ExtensionSet for ListValue {
1240    const PROTO_FQN: &'static str = "google.protobuf.ListValue";
1241    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1242        &self.__buffa_unknown_fields
1243    }
1244    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1245        &mut self.__buffa_unknown_fields
1246    }
1247}
1248impl ::buffa::text::TextFormat for ListValue {
1249    fn encode_text(
1250        &self,
1251        enc: &mut ::buffa::text::TextEncoder<'_>,
1252    ) -> ::core::fmt::Result {
1253        #[allow(unused_imports)]
1254        use ::buffa::Enumeration as _;
1255        for __v in &self.values {
1256            enc.write_field_name("values")?;
1257            enc.write_message(__v)?;
1258        }
1259        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1260        ::core::result::Result::Ok(())
1261    }
1262    fn merge_text(
1263        &mut self,
1264        dec: &mut ::buffa::text::TextDecoder<'_>,
1265    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1266        #[allow(unused_imports)]
1267        use ::buffa::Enumeration as _;
1268        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1269            match __name {
1270                "values" => {
1271                    dec.read_repeated_into(
1272                        &mut self.values,
1273                        |__d| {
1274                            let mut __m = ::core::default::Default::default();
1275                            __d.merge_message(&mut __m)?;
1276                            ::core::result::Result::Ok(__m)
1277                        },
1278                    )?
1279                }
1280                _ => dec.skip_value()?,
1281            }
1282        }
1283        ::core::result::Result::Ok(())
1284    }
1285}
1286#[doc(hidden)]
1287pub const __LIST_VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1288    type_url: "type.googleapis.com/google.protobuf.ListValue",
1289    text_encode: ::buffa::type_registry::any_encode_text::<ListValue>,
1290    text_merge: ::buffa::type_registry::any_merge_text::<ListValue>,
1291};
1292/// `ListValue` is a wrapper around a repeated field of values.
1293///
1294/// The JSON representation for `ListValue` is JSON array.
1295#[derive(Clone, Debug, Default)]
1296pub struct ListValueView<'a> {
1297    /// Repeated field of dynamically typed values.
1298    ///
1299    /// Field 1: `values`
1300    pub values: ::buffa::RepeatedView<'a, ValueView<'a>>,
1301    pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1302}
1303impl<'a> ListValueView<'a> {
1304    /// Decode from `buf`, enforcing a recursion depth limit for nested messages.
1305    ///
1306    /// Called by [`::buffa::MessageView::decode_view`] with [`::buffa::RECURSION_LIMIT`]
1307    /// and by generated sub-message decode arms with `depth - 1`.
1308    ///
1309    /// **Not part of the public API.** Named with a leading underscore to
1310    /// signal that it is for generated-code use only.
1311    #[doc(hidden)]
1312    pub fn _decode_depth(
1313        buf: &'a [u8],
1314        depth: u32,
1315    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1316        let mut view = Self::default();
1317        view._merge_into_view(buf, depth)?;
1318        ::core::result::Result::Ok(view)
1319    }
1320    /// Merge fields from `buf` into this view (proto merge semantics).
1321    ///
1322    /// Repeated fields append; singular fields last-wins; singular
1323    /// MESSAGE fields merge recursively. Used by sub-message decode
1324    /// arms when the same field appears multiple times on the wire.
1325    ///
1326    /// **Not part of the public API.**
1327    #[doc(hidden)]
1328    pub fn _merge_into_view(
1329        &mut self,
1330        buf: &'a [u8],
1331        depth: u32,
1332    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1333        let _ = depth;
1334        #[allow(unused_variables)]
1335        let view = self;
1336        let mut cur: &'a [u8] = buf;
1337        while !cur.is_empty() {
1338            let before_tag = cur;
1339            let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1340            match tag.field_number() {
1341                1u32 => {
1342                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1343                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1344                            field_number: 1u32,
1345                            expected: 2u8,
1346                            actual: tag.wire_type() as u8,
1347                        });
1348                    }
1349                    if depth == 0 {
1350                        return Err(::buffa::DecodeError::RecursionLimitExceeded);
1351                    }
1352                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1353                    view.values.push(ValueView::_decode_depth(sub, depth - 1)?);
1354                }
1355                _ => {
1356                    ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1357                    let span_len = before_tag.len() - cur.len();
1358                    view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1359                }
1360            }
1361        }
1362        ::core::result::Result::Ok(())
1363    }
1364}
1365impl<'a> ::buffa::MessageView<'a> for ListValueView<'a> {
1366    type Owned = ListValue;
1367    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1368        Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1369    }
1370    fn decode_view_with_limit(
1371        buf: &'a [u8],
1372        depth: u32,
1373    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1374        Self::_decode_depth(buf, depth)
1375    }
1376    /// Convert this view to the owned message type.
1377    #[allow(clippy::redundant_closure, clippy::useless_conversion)]
1378    fn to_owned_message(&self) -> ListValue {
1379        #[allow(unused_imports)]
1380        use ::buffa::alloc::string::ToString as _;
1381        ListValue {
1382            values: self.values.iter().map(|v| v.to_owned_message()).collect(),
1383            __buffa_unknown_fields: self
1384                .__buffa_unknown_fields
1385                .to_owned()
1386                .unwrap_or_default()
1387                .into(),
1388            ..::core::default::Default::default()
1389        }
1390    }
1391}
1392unsafe impl ::buffa::DefaultViewInstance for ListValueView<'static> {
1393    fn default_view_instance() -> &'static Self {
1394        static VALUE: ::buffa::__private::OnceBox<ListValueView<'static>> = ::buffa::__private::OnceBox::new();
1395        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1396    }
1397}
1398unsafe impl<'a> ::buffa::HasDefaultViewInstance for ListValueView<'a> {
1399    type Static = ListValueView<'static>;
1400}