Skip to main content

buffa_types/generated/
google.protobuf.struct.__view.rs

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