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