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