Skip to main content

fast_mvt/generated/
vector_tile.__view.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2// source: vector_tile.proto
3
4#[derive(Clone, Debug, Default)]
5pub struct TileView<'a> {
6    /// Field 3: `layers`
7    pub layers: ::buffa::RepeatedView<
8        'a,
9        super::super::__buffa::view::tile::LayerView<'a>,
10    >,
11}
12impl<'a> ::buffa::MessageView<'a> for TileView<'a> {
13    type Owned = super::super::Tile;
14    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
15        let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
16        <Self as ::buffa::MessageView>::decode_view_ctx(
17            buf,
18            ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
19        )
20    }
21    fn decode_view_with_ctx(
22        buf: &'a [u8],
23        ctx: ::buffa::DecodeContext<'_>,
24    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
25        <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
26    }
27    #[inline]
28    fn merge_view_field(
29        &mut self,
30        tag: ::buffa::encoding::Tag,
31        cur: &'a [u8],
32        _before_tag: &'a [u8],
33        ctx: ::buffa::DecodeContext<'_>,
34    ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
35        let _ = ctx;
36        #[allow(unused_variables)]
37        let view = self;
38        let mut cur = cur;
39        match tag.field_number() {
40            3u32 => {
41                ::buffa::encoding::check_wire_type(
42                    tag,
43                    ::buffa::encoding::WireType::LengthDelimited,
44                )?;
45                let __sub_ctx = ctx.descend()?;
46                let sub = ::buffa::types::borrow_bytes(&mut cur)?;
47                ctx.register_element_memory(
48                    ::core::mem::size_of::<
49                        super::super::__buffa::view::tile::LayerView,
50                    >(),
51                )?;
52                view.layers
53                    .push(
54                        <super::super::__buffa::view::tile::LayerView as ::buffa::MessageView>::decode_view_ctx(
55                            sub,
56                            __sub_ctx,
57                        )?,
58                    );
59            }
60            _ => {
61                ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
62            }
63        }
64        ::core::result::Result::Ok(cur)
65    }
66    fn to_owned_message(
67        &self,
68    ) -> ::core::result::Result<super::super::Tile, ::buffa::DecodeError> {
69        self.to_owned_from_source(None)
70    }
71    #[allow(clippy::useless_conversion, clippy::needless_update)]
72    fn to_owned_from_source(
73        &self,
74        __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
75    ) -> ::core::result::Result<super::super::Tile, ::buffa::DecodeError> {
76        #[allow(unused_imports)]
77        use ::buffa::alloc::string::ToString as _;
78        let _ = __buffa_src;
79        ::core::result::Result::Ok(super::super::Tile {
80            layers: self
81                .layers
82                .iter()
83                .map(|v| v.to_owned_from_source(__buffa_src))
84                .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
85            ..::core::default::Default::default()
86        })
87    }
88}
89impl<'a> ::buffa::ViewEncode<'a> for TileView<'a> {
90    #[allow(clippy::needless_borrow, clippy::let_and_return)]
91    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
92        #[allow(unused_imports)]
93        use ::buffa::Enumeration as _;
94        let mut size = 0u64;
95        for v in &self.layers {
96            let __slot = __cache.reserve();
97            let inner_size = v.compute_size(__cache);
98            __cache.set(__slot, inner_size);
99            size
100                += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
101                    + inner_size as u64;
102        }
103        ::buffa::saturate_size(size)
104    }
105    #[allow(clippy::needless_borrow)]
106    fn write_to(
107        &self,
108        __cache: &mut ::buffa::SizeCache,
109        buf: &mut impl ::buffa::EncodeSink,
110    ) {
111        #[allow(unused_imports)]
112        use ::buffa::Enumeration as _;
113        for v in &self.layers {
114            ::buffa::types::put_len_delimited_header(
115                3u32,
116                u64::from(__cache.consume_next()),
117                buf,
118            );
119            v.write_to(__cache, buf);
120        }
121    }
122}
123#[cfg(feature = "json")]
124/// Serializes this view as protobuf JSON.
125///
126/// Implicit-presence fields with default values are omitted, `required`
127/// fields are always emitted, explicit-presence (`optional`) fields are
128/// emitted only when set, bytes fields are base64-encoded, and enum
129/// values are their proto name strings.
130///
131/// This impl uses `serialize_map(None)` because the number of emitted
132/// fields depends on default-omission rules; serializers that require
133/// known map lengths (e.g. `bincode`) will return a runtime error.
134/// Use the owned message type for those formats.
135impl<'__a> ::serde::Serialize for TileView<'__a> {
136    fn serialize<__S: ::serde::Serializer>(
137        &self,
138        __s: __S,
139    ) -> ::core::result::Result<__S::Ok, __S::Error> {
140        use ::serde::ser::SerializeMap as _;
141        let mut __map = __s.serialize_map(::core::option::Option::None)?;
142        if !self.layers.is_empty() {
143            __map.serialize_entry("layers", &*self.layers)?;
144        }
145        __map.end()
146    }
147}
148impl<'a> ::buffa::MessageName for TileView<'a> {
149    const PACKAGE: &'static str = "vector_tile";
150    const NAME: &'static str = "Tile";
151    const FULL_NAME: &'static str = "vector_tile.Tile";
152    const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile";
153}
154::buffa::impl_default_view_instance!(TileView);
155::buffa::impl_view_reborrow!(TileView);
156/** Self-contained, `'static` owned view of a `Tile` message.
157
158 Wraps [`::buffa::OwnedView`]`<`[`TileView`]`<'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.
159
160 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`TileView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
161#[derive(Clone, Debug)]
162pub struct TileOwnedView(::buffa::OwnedView<TileView<'static>>);
163impl TileOwnedView {
164    /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
165    ///
166    /// The view borrows directly from the buffer's data; the buffer is
167    /// retained inside the returned handle.
168    ///
169    /// # Errors
170    ///
171    /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
172    /// protobuf data.
173    pub fn decode(
174        bytes: ::buffa::bytes::Bytes,
175    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
176        ::core::result::Result::Ok(TileOwnedView(::buffa::OwnedView::decode(bytes)?))
177    }
178    /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
179    /// max message size).
180    ///
181    /// # Errors
182    ///
183    /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
184    /// exceeds the configured limits.
185    pub fn decode_with_options(
186        bytes: ::buffa::bytes::Bytes,
187        opts: &::buffa::DecodeOptions,
188    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
189        ::core::result::Result::Ok(
190            TileOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
191        )
192    }
193    /// Build from an owned message via an encode → decode round-trip.
194    ///
195    /// # Errors
196    ///
197    /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the
198    /// message's encoded size exceeds the 2 GiB protobuf limit, or
199    /// another [`::buffa::DecodeError`] if the re-encoded bytes are
200    /// somehow invalid (should not happen for well-formed messages).
201    pub fn from_owned(
202        msg: &super::super::Tile,
203    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
204        ::core::result::Result::Ok(TileOwnedView(::buffa::OwnedView::from_owned(msg)?))
205    }
206    /// Borrow the full [`TileView`] with its lifetime tied to `&self`.
207    #[must_use]
208    pub fn view(&self) -> &TileView<'_> {
209        self.0.reborrow()
210    }
211    /// Convert to the owned message type.
212    ///
213    /// Infallible: this type's constructors wire-decode their
214    /// buffer, and a view produced by wire decoding always
215    /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`],
216    /// whose contract also governs handles converted from a raw
217    /// [`::buffa::OwnedView`].
218    #[must_use]
219    pub fn to_owned_message(&self) -> super::super::Tile {
220        self.0.to_owned_message()
221    }
222    /// The underlying bytes buffer.
223    #[must_use]
224    pub fn bytes(&self) -> &::buffa::bytes::Bytes {
225        self.0.bytes()
226    }
227    /// Consume the handle, returning the underlying bytes buffer.
228    #[must_use]
229    pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
230        self.0.into_bytes()
231    }
232    /// Field 3: `layers`
233    #[must_use]
234    pub fn layers(
235        &self,
236    ) -> &::buffa::RepeatedView<'_, super::super::__buffa::view::tile::LayerView<'_>> {
237        &self.0.reborrow().layers
238    }
239}
240impl ::core::convert::From<::buffa::OwnedView<TileView<'static>>> for TileOwnedView {
241    fn from(inner: ::buffa::OwnedView<TileView<'static>>) -> Self {
242        TileOwnedView(inner)
243    }
244}
245impl ::core::convert::From<TileOwnedView> for ::buffa::OwnedView<TileView<'static>> {
246    fn from(wrapper: TileOwnedView) -> Self {
247        wrapper.0
248    }
249}
250impl ::core::convert::AsRef<::buffa::OwnedView<TileView<'static>>> for TileOwnedView {
251    fn as_ref(&self) -> &::buffa::OwnedView<TileView<'static>> {
252        &self.0
253    }
254}
255impl ::buffa::HasMessageView for super::super::Tile {
256    type View<'a> = TileView<'a>;
257    type ViewHandle = TileOwnedView;
258}
259#[cfg(feature = "json")]
260impl ::serde::Serialize for TileOwnedView {
261    fn serialize<__S: ::serde::Serializer>(
262        &self,
263        __s: __S,
264    ) -> ::core::result::Result<__S::Ok, __S::Error> {
265        ::serde::Serialize::serialize(&self.0, __s)
266    }
267}
268pub mod tile {
269    #[allow(unused_imports)]
270    use super::*;
271    /// Variant type encoding
272    /// The use of values is described in section 4.1 of the specification
273    #[derive(Clone, Debug, Default)]
274    pub struct ValueView<'a> {
275        /// Exactly one of these values must be present in a valid message
276        ///
277        /// Field 1: `string_value`
278        pub string_value: ::core::option::Option<&'a str>,
279        /// Field 2: `float_value`
280        pub float_value: ::core::option::Option<f32>,
281        /// Field 3: `double_value`
282        pub double_value: ::core::option::Option<f64>,
283        /// Field 4: `int_value`
284        pub int_value: ::core::option::Option<i64>,
285        /// Field 5: `uint_value`
286        pub uint_value: ::core::option::Option<u64>,
287        /// Field 6: `sint_value`
288        pub sint_value: ::core::option::Option<i64>,
289        /// Field 7: `bool_value`
290        pub bool_value: ::core::option::Option<bool>,
291    }
292    impl<'a> ::buffa::MessageView<'a> for ValueView<'a> {
293        type Owned = super::super::super::tile::Value;
294        fn decode_view(
295            buf: &'a [u8],
296        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
297            let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
298            <Self as ::buffa::MessageView>::decode_view_ctx(
299                buf,
300                ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
301            )
302        }
303        fn decode_view_with_ctx(
304            buf: &'a [u8],
305            ctx: ::buffa::DecodeContext<'_>,
306        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
307            <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
308        }
309        #[inline]
310        fn merge_view_field(
311            &mut self,
312            tag: ::buffa::encoding::Tag,
313            cur: &'a [u8],
314            _before_tag: &'a [u8],
315            ctx: ::buffa::DecodeContext<'_>,
316        ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
317            let _ = ctx;
318            #[allow(unused_variables)]
319            let view = self;
320            let mut cur = cur;
321            match tag.field_number() {
322                1u32 => {
323                    ::buffa::encoding::check_wire_type(
324                        tag,
325                        ::buffa::encoding::WireType::LengthDelimited,
326                    )?;
327                    view.string_value = Some(::buffa::types::borrow_str(&mut cur)?);
328                }
329                2u32 => {
330                    ::buffa::encoding::check_wire_type(
331                        tag,
332                        ::buffa::encoding::WireType::Fixed32,
333                    )?;
334                    view.float_value = Some(::buffa::types::decode_float(&mut cur)?);
335                }
336                3u32 => {
337                    ::buffa::encoding::check_wire_type(
338                        tag,
339                        ::buffa::encoding::WireType::Fixed64,
340                    )?;
341                    view.double_value = Some(::buffa::types::decode_double(&mut cur)?);
342                }
343                4u32 => {
344                    ::buffa::encoding::check_wire_type(
345                        tag,
346                        ::buffa::encoding::WireType::Varint,
347                    )?;
348                    view.int_value = Some(::buffa::types::decode_int64(&mut cur)?);
349                }
350                5u32 => {
351                    ::buffa::encoding::check_wire_type(
352                        tag,
353                        ::buffa::encoding::WireType::Varint,
354                    )?;
355                    view.uint_value = Some(::buffa::types::decode_uint64(&mut cur)?);
356                }
357                6u32 => {
358                    ::buffa::encoding::check_wire_type(
359                        tag,
360                        ::buffa::encoding::WireType::Varint,
361                    )?;
362                    view.sint_value = Some(::buffa::types::decode_sint64(&mut cur)?);
363                }
364                7u32 => {
365                    ::buffa::encoding::check_wire_type(
366                        tag,
367                        ::buffa::encoding::WireType::Varint,
368                    )?;
369                    view.bool_value = Some(::buffa::types::decode_bool(&mut cur)?);
370                }
371                _ => {
372                    ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
373                }
374            }
375            ::core::result::Result::Ok(cur)
376        }
377        fn to_owned_message(
378            &self,
379        ) -> ::core::result::Result<
380            super::super::super::tile::Value,
381            ::buffa::DecodeError,
382        > {
383            self.to_owned_from_source(None)
384        }
385        #[allow(clippy::useless_conversion, clippy::needless_update)]
386        fn to_owned_from_source(
387            &self,
388            __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
389        ) -> ::core::result::Result<
390            super::super::super::tile::Value,
391            ::buffa::DecodeError,
392        > {
393            #[allow(unused_imports)]
394            use ::buffa::alloc::string::ToString as _;
395            let _ = __buffa_src;
396            ::core::result::Result::Ok(super::super::super::tile::Value {
397                string_value: self.string_value.map(|s| s.to_string()),
398                float_value: self.float_value,
399                double_value: self.double_value,
400                int_value: self.int_value,
401                uint_value: self.uint_value,
402                sint_value: self.sint_value,
403                bool_value: self.bool_value,
404                ..::core::default::Default::default()
405            })
406        }
407    }
408    impl<'a> ::buffa::ViewEncode<'a> for ValueView<'a> {
409        #[allow(clippy::needless_borrow, clippy::let_and_return)]
410        fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
411            #[allow(unused_imports)]
412            use ::buffa::Enumeration as _;
413            let mut size = 0u64;
414            if let Some(ref v) = self.string_value {
415                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
416            }
417            if self.float_value.is_some() {
418                size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64;
419            }
420            if self.double_value.is_some() {
421                size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64;
422            }
423            if let Some(v) = self.int_value {
424                size += 1u64 + ::buffa::types::int64_encoded_len(v) as u64;
425            }
426            if let Some(v) = self.uint_value {
427                size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64;
428            }
429            if let Some(v) = self.sint_value {
430                size += 1u64 + ::buffa::types::sint64_encoded_len(v) as u64;
431            }
432            if self.bool_value.is_some() {
433                size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
434            }
435            ::buffa::saturate_size(size)
436        }
437        #[allow(clippy::needless_borrow)]
438        fn write_to(
439            &self,
440            _cache: &mut ::buffa::SizeCache,
441            buf: &mut impl ::buffa::EncodeSink,
442        ) {
443            #[allow(unused_imports)]
444            use ::buffa::Enumeration as _;
445            if let Some(ref v) = self.string_value {
446                ::buffa::types::put_string_field(1u32, v, buf);
447            }
448            if let Some(v) = self.float_value {
449                ::buffa::types::put_float_field(2u32, v, buf);
450            }
451            if let Some(v) = self.double_value {
452                ::buffa::types::put_double_field(3u32, v, buf);
453            }
454            if let Some(v) = self.int_value {
455                ::buffa::types::put_int64_field(4u32, v, buf);
456            }
457            if let Some(v) = self.uint_value {
458                ::buffa::types::put_uint64_field(5u32, v, buf);
459            }
460            if let Some(v) = self.sint_value {
461                ::buffa::types::put_sint64_field(6u32, v, buf);
462            }
463            if let Some(v) = self.bool_value {
464                ::buffa::types::put_bool_field(7u32, v, buf);
465            }
466        }
467    }
468    #[cfg(feature = "json")]
469    /// Serializes this view as protobuf JSON.
470    ///
471    /// Implicit-presence fields with default values are omitted, `required`
472    /// fields are always emitted, explicit-presence (`optional`) fields are
473    /// emitted only when set, bytes fields are base64-encoded, and enum
474    /// values are their proto name strings.
475    ///
476    /// This impl uses `serialize_map(None)` because the number of emitted
477    /// fields depends on default-omission rules; serializers that require
478    /// known map lengths (e.g. `bincode`) will return a runtime error.
479    /// Use the owned message type for those formats.
480    impl<'__a> ::serde::Serialize for ValueView<'__a> {
481        fn serialize<__S: ::serde::Serializer>(
482            &self,
483            __s: __S,
484        ) -> ::core::result::Result<__S::Ok, __S::Error> {
485            use ::serde::ser::SerializeMap as _;
486            let mut __map = __s.serialize_map(::core::option::Option::None)?;
487            if let ::core::option::Option::Some(__v) = self.string_value {
488                __map.serialize_entry("stringValue", __v)?;
489            }
490            if let ::core::option::Option::Some(__v) = self.float_value {
491                __map
492                    .serialize_entry(
493                        "floatValue",
494                        &::buffa::json_helpers::ProtoJson(&__v),
495                    )?;
496            }
497            if let ::core::option::Option::Some(__v) = self.double_value {
498                __map
499                    .serialize_entry(
500                        "doubleValue",
501                        &::buffa::json_helpers::ProtoJson(&__v),
502                    )?;
503            }
504            if let ::core::option::Option::Some(__v) = self.int_value {
505                __map
506                    .serialize_entry(
507                        "intValue",
508                        &::buffa::json_helpers::ProtoJson(&__v),
509                    )?;
510            }
511            if let ::core::option::Option::Some(__v) = self.uint_value {
512                __map
513                    .serialize_entry(
514                        "uintValue",
515                        &::buffa::json_helpers::ProtoJson(&__v),
516                    )?;
517            }
518            if let ::core::option::Option::Some(__v) = self.sint_value {
519                __map
520                    .serialize_entry(
521                        "sintValue",
522                        &::buffa::json_helpers::ProtoJson(&__v),
523                    )?;
524            }
525            if let ::core::option::Option::Some(__v) = self.bool_value {
526                __map.serialize_entry("boolValue", &__v)?;
527            }
528            __map.end()
529        }
530    }
531    impl<'a> ::buffa::MessageName for ValueView<'a> {
532        const PACKAGE: &'static str = "vector_tile";
533        const NAME: &'static str = "Tile.Value";
534        const FULL_NAME: &'static str = "vector_tile.Tile.Value";
535        const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Value";
536    }
537    ::buffa::impl_default_view_instance!(ValueView);
538    ::buffa::impl_view_reborrow!(ValueView);
539    /** Self-contained, `'static` owned view of a `Value` message.
540
541 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.
542
543 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.*/
544    #[derive(Clone, Debug)]
545    pub struct ValueOwnedView(::buffa::OwnedView<ValueView<'static>>);
546    impl ValueOwnedView {
547        /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
548        ///
549        /// The view borrows directly from the buffer's data; the buffer is
550        /// retained inside the returned handle.
551        ///
552        /// # Errors
553        ///
554        /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
555        /// protobuf data.
556        pub fn decode(
557            bytes: ::buffa::bytes::Bytes,
558        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
559            ::core::result::Result::Ok(
560                ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
561            )
562        }
563        /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
564        /// max message size).
565        ///
566        /// # Errors
567        ///
568        /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
569        /// exceeds the configured limits.
570        pub fn decode_with_options(
571            bytes: ::buffa::bytes::Bytes,
572            opts: &::buffa::DecodeOptions,
573        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
574            ::core::result::Result::Ok(
575                ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
576            )
577        }
578        /// Build from an owned message via an encode → decode round-trip.
579        ///
580        /// # Errors
581        ///
582        /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the
583        /// message's encoded size exceeds the 2 GiB protobuf limit, or
584        /// another [`::buffa::DecodeError`] if the re-encoded bytes are
585        /// somehow invalid (should not happen for well-formed messages).
586        pub fn from_owned(
587            msg: &super::super::super::tile::Value,
588        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
589            ::core::result::Result::Ok(
590                ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
591            )
592        }
593        /// Borrow the full [`ValueView`] with its lifetime tied to `&self`.
594        #[must_use]
595        pub fn view(&self) -> &ValueView<'_> {
596            self.0.reborrow()
597        }
598        /// Convert to the owned message type.
599        ///
600        /// Infallible: this type's constructors wire-decode their
601        /// buffer, and a view produced by wire decoding always
602        /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`],
603        /// whose contract also governs handles converted from a raw
604        /// [`::buffa::OwnedView`].
605        #[must_use]
606        pub fn to_owned_message(&self) -> super::super::super::tile::Value {
607            self.0.to_owned_message()
608        }
609        /// The underlying bytes buffer.
610        #[must_use]
611        pub fn bytes(&self) -> &::buffa::bytes::Bytes {
612            self.0.bytes()
613        }
614        /// Consume the handle, returning the underlying bytes buffer.
615        #[must_use]
616        pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
617            self.0.into_bytes()
618        }
619        /// Exactly one of these values must be present in a valid message
620        ///
621        /// Field 1: `string_value`
622        #[must_use]
623        pub fn string_value(&self) -> ::core::option::Option<&'_ str> {
624            self.0.reborrow().string_value
625        }
626        /// Field 2: `float_value`
627        #[must_use]
628        pub fn float_value(&self) -> ::core::option::Option<f32> {
629            self.0.reborrow().float_value
630        }
631        /// Field 3: `double_value`
632        #[must_use]
633        pub fn double_value(&self) -> ::core::option::Option<f64> {
634            self.0.reborrow().double_value
635        }
636        /// Field 4: `int_value`
637        #[must_use]
638        pub fn int_value(&self) -> ::core::option::Option<i64> {
639            self.0.reborrow().int_value
640        }
641        /// Field 5: `uint_value`
642        #[must_use]
643        pub fn uint_value(&self) -> ::core::option::Option<u64> {
644            self.0.reborrow().uint_value
645        }
646        /// Field 6: `sint_value`
647        #[must_use]
648        pub fn sint_value(&self) -> ::core::option::Option<i64> {
649            self.0.reborrow().sint_value
650        }
651        /// Field 7: `bool_value`
652        #[must_use]
653        pub fn bool_value(&self) -> ::core::option::Option<bool> {
654            self.0.reborrow().bool_value
655        }
656    }
657    impl ::core::convert::From<::buffa::OwnedView<ValueView<'static>>>
658    for ValueOwnedView {
659        fn from(inner: ::buffa::OwnedView<ValueView<'static>>) -> Self {
660            ValueOwnedView(inner)
661        }
662    }
663    impl ::core::convert::From<ValueOwnedView>
664    for ::buffa::OwnedView<ValueView<'static>> {
665        fn from(wrapper: ValueOwnedView) -> Self {
666            wrapper.0
667        }
668    }
669    impl ::core::convert::AsRef<::buffa::OwnedView<ValueView<'static>>>
670    for ValueOwnedView {
671        fn as_ref(&self) -> &::buffa::OwnedView<ValueView<'static>> {
672            &self.0
673        }
674    }
675    impl ::buffa::HasMessageView for super::super::super::tile::Value {
676        type View<'a> = ValueView<'a>;
677        type ViewHandle = ValueOwnedView;
678    }
679    #[cfg(feature = "json")]
680    impl ::serde::Serialize for ValueOwnedView {
681        fn serialize<__S: ::serde::Serializer>(
682            &self,
683            __s: __S,
684        ) -> ::core::result::Result<__S::Ok, __S::Error> {
685            ::serde::Serialize::serialize(&self.0, __s)
686        }
687    }
688    /// Features are described in section 4.2 of the specification
689    #[derive(Clone, Debug, Default)]
690    pub struct FeatureView<'a> {
691        /// Field 1: `id`
692        pub id: ::core::option::Option<u64>,
693        /// Tags of this feature are encoded as repeated pairs of
694        /// integers.
695        /// A detailed description of tags is located in sections
696        /// 4.2 and 4.4 of the specification
697        ///
698        /// Field 2: `tags`
699        pub tags: ::buffa::RepeatedView<'a, u32>,
700        /// The type of geometry stored in this feature.
701        ///
702        /// Field 3: `type`
703        pub r#type: ::core::option::Option<super::super::super::tile::GeomType>,
704        /// Contains a stream of commands and parameters (vertices).
705        /// A detailed description on geometry encoding is located in
706        /// section 4.3 of the specification.
707        ///
708        /// Field 4: `geometry`
709        pub geometry: ::buffa::RepeatedView<'a, u32>,
710    }
711    impl<'a> ::buffa::MessageView<'a> for FeatureView<'a> {
712        type Owned = super::super::super::tile::Feature;
713        fn decode_view(
714            buf: &'a [u8],
715        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
716            let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
717            <Self as ::buffa::MessageView>::decode_view_ctx(
718                buf,
719                ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
720            )
721        }
722        fn decode_view_with_ctx(
723            buf: &'a [u8],
724            ctx: ::buffa::DecodeContext<'_>,
725        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
726            <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
727        }
728        #[inline]
729        fn merge_view_field(
730            &mut self,
731            tag: ::buffa::encoding::Tag,
732            cur: &'a [u8],
733            _before_tag: &'a [u8],
734            ctx: ::buffa::DecodeContext<'_>,
735        ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
736            let _ = ctx;
737            #[allow(unused_variables)]
738            let view = self;
739            let mut cur = cur;
740            match tag.field_number() {
741                1u32 => {
742                    ::buffa::encoding::check_wire_type(
743                        tag,
744                        ::buffa::encoding::WireType::Varint,
745                    )?;
746                    view.id = Some(::buffa::types::decode_uint64(&mut cur)?);
747                }
748                3u32 => {
749                    ::buffa::encoding::check_wire_type(
750                        tag,
751                        ::buffa::encoding::WireType::Varint,
752                    )?;
753                    let __raw = ::buffa::types::decode_int32(&mut cur)?;
754                    if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
755                        __raw,
756                    ) {
757                        view.r#type = Some(__v);
758                    }
759                }
760                2u32 => {
761                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
762                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
763                        ::buffa::types::extend_packed_uint32(
764                            payload,
765                            view.tags.as_mut_vec(),
766                            ::buffa::encoding::count_varints(payload),
767                        )?;
768                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
769                        view.tags.push(::buffa::types::decode_uint32(&mut cur)?);
770                    } else {
771                        return Err(
772                            ::buffa::encoding::wire_type_mismatch(
773                                tag,
774                                ::buffa::encoding::WireType::LengthDelimited,
775                            ),
776                        );
777                    }
778                }
779                4u32 => {
780                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
781                        let payload = ::buffa::types::borrow_bytes(&mut cur)?;
782                        ::buffa::types::extend_packed_uint32(
783                            payload,
784                            view.geometry.as_mut_vec(),
785                            ::buffa::encoding::count_varints(payload),
786                        )?;
787                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
788                        view.geometry.push(::buffa::types::decode_uint32(&mut cur)?);
789                    } else {
790                        return Err(
791                            ::buffa::encoding::wire_type_mismatch(
792                                tag,
793                                ::buffa::encoding::WireType::LengthDelimited,
794                            ),
795                        );
796                    }
797                }
798                _ => {
799                    ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
800                }
801            }
802            ::core::result::Result::Ok(cur)
803        }
804        fn to_owned_message(
805            &self,
806        ) -> ::core::result::Result<
807            super::super::super::tile::Feature,
808            ::buffa::DecodeError,
809        > {
810            self.to_owned_from_source(None)
811        }
812        #[allow(clippy::useless_conversion, clippy::needless_update)]
813        fn to_owned_from_source(
814            &self,
815            __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
816        ) -> ::core::result::Result<
817            super::super::super::tile::Feature,
818            ::buffa::DecodeError,
819        > {
820            #[allow(unused_imports)]
821            use ::buffa::alloc::string::ToString as _;
822            let _ = __buffa_src;
823            ::core::result::Result::Ok(super::super::super::tile::Feature {
824                id: self.id,
825                tags: self.tags.to_vec(),
826                r#type: self.r#type,
827                geometry: self.geometry.to_vec(),
828                ..::core::default::Default::default()
829            })
830        }
831    }
832    impl<'a> ::buffa::ViewEncode<'a> for FeatureView<'a> {
833        #[allow(clippy::needless_borrow, clippy::let_and_return)]
834        fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
835            #[allow(unused_imports)]
836            use ::buffa::Enumeration as _;
837            let mut size = 0u64;
838            if let Some(v) = self.id {
839                size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64;
840            }
841            if !self.tags.is_empty() {
842                let payload: u64 = self
843                    .tags
844                    .iter()
845                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
846                    .sum::<u64>();
847                size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload;
848            }
849            if let Some(ref v) = self.r#type {
850                size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64;
851            }
852            if !self.geometry.is_empty() {
853                let payload: u64 = self
854                    .geometry
855                    .iter()
856                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
857                    .sum::<u64>();
858                size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload;
859            }
860            ::buffa::saturate_size(size)
861        }
862        #[allow(clippy::needless_borrow)]
863        fn write_to(
864            &self,
865            _cache: &mut ::buffa::SizeCache,
866            buf: &mut impl ::buffa::EncodeSink,
867        ) {
868            #[allow(unused_imports)]
869            use ::buffa::Enumeration as _;
870            if let Some(v) = self.id {
871                ::buffa::types::put_uint64_field(1u32, v, buf);
872            }
873            if !self.tags.is_empty() {
874                let payload: u64 = self
875                    .tags
876                    .iter()
877                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
878                    .sum::<u64>();
879                ::buffa::types::put_len_delimited_header(2u32, payload, buf);
880                for &v in &self.tags {
881                    ::buffa::types::encode_uint32(v, buf);
882                }
883            }
884            if let Some(ref v) = self.r#type {
885                ::buffa::types::put_int32_field(3u32, v.to_i32(), buf);
886            }
887            if !self.geometry.is_empty() {
888                let payload: u64 = self
889                    .geometry
890                    .iter()
891                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
892                    .sum::<u64>();
893                ::buffa::types::put_len_delimited_header(4u32, payload, buf);
894                for &v in &self.geometry {
895                    ::buffa::types::encode_uint32(v, buf);
896                }
897            }
898        }
899    }
900    #[cfg(feature = "json")]
901    /// Serializes this view as protobuf JSON.
902    ///
903    /// Implicit-presence fields with default values are omitted, `required`
904    /// fields are always emitted, explicit-presence (`optional`) fields are
905    /// emitted only when set, bytes fields are base64-encoded, and enum
906    /// values are their proto name strings.
907    ///
908    /// This impl uses `serialize_map(None)` because the number of emitted
909    /// fields depends on default-omission rules; serializers that require
910    /// known map lengths (e.g. `bincode`) will return a runtime error.
911    /// Use the owned message type for those formats.
912    impl<'__a> ::serde::Serialize for FeatureView<'__a> {
913        fn serialize<__S: ::serde::Serializer>(
914            &self,
915            __s: __S,
916        ) -> ::core::result::Result<__S::Ok, __S::Error> {
917            use ::serde::ser::SerializeMap as _;
918            let mut __map = __s.serialize_map(::core::option::Option::None)?;
919            if let ::core::option::Option::Some(__v) = self.id {
920                __map.serialize_entry("id", &::buffa::json_helpers::ProtoJson(&__v))?;
921            }
922            if !self.tags.is_empty() {
923                __map
924                    .serialize_entry(
925                        "tags",
926                        &::buffa::json_helpers::RepeatedJson(&self.tags),
927                    )?;
928            }
929            if let ::core::option::Option::Some(__v) = self.r#type {
930                __map
931                    .serialize_entry(
932                        "type",
933                        &::buffa::json_helpers::ClosedEnumJson(&__v),
934                    )?;
935            }
936            if !self.geometry.is_empty() {
937                __map
938                    .serialize_entry(
939                        "geometry",
940                        &::buffa::json_helpers::RepeatedJson(&self.geometry),
941                    )?;
942            }
943            __map.end()
944        }
945    }
946    impl<'a> ::buffa::MessageName for FeatureView<'a> {
947        const PACKAGE: &'static str = "vector_tile";
948        const NAME: &'static str = "Tile.Feature";
949        const FULL_NAME: &'static str = "vector_tile.Tile.Feature";
950        const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Feature";
951    }
952    ::buffa::impl_default_view_instance!(FeatureView);
953    ::buffa::impl_view_reborrow!(FeatureView);
954    /** Self-contained, `'static` owned view of a `Feature` message.
955
956 Wraps [`::buffa::OwnedView`]`<`[`FeatureView`]`<'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.
957
958 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`FeatureView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
959    #[derive(Clone, Debug)]
960    pub struct FeatureOwnedView(::buffa::OwnedView<FeatureView<'static>>);
961    impl FeatureOwnedView {
962        /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
963        ///
964        /// The view borrows directly from the buffer's data; the buffer is
965        /// retained inside the returned handle.
966        ///
967        /// # Errors
968        ///
969        /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
970        /// protobuf data.
971        pub fn decode(
972            bytes: ::buffa::bytes::Bytes,
973        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
974            ::core::result::Result::Ok(
975                FeatureOwnedView(::buffa::OwnedView::decode(bytes)?),
976            )
977        }
978        /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
979        /// max message size).
980        ///
981        /// # Errors
982        ///
983        /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
984        /// exceeds the configured limits.
985        pub fn decode_with_options(
986            bytes: ::buffa::bytes::Bytes,
987            opts: &::buffa::DecodeOptions,
988        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
989            ::core::result::Result::Ok(
990                FeatureOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
991            )
992        }
993        /// Build from an owned message via an encode → decode round-trip.
994        ///
995        /// # Errors
996        ///
997        /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the
998        /// message's encoded size exceeds the 2 GiB protobuf limit, or
999        /// another [`::buffa::DecodeError`] if the re-encoded bytes are
1000        /// somehow invalid (should not happen for well-formed messages).
1001        pub fn from_owned(
1002            msg: &super::super::super::tile::Feature,
1003        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1004            ::core::result::Result::Ok(
1005                FeatureOwnedView(::buffa::OwnedView::from_owned(msg)?),
1006            )
1007        }
1008        /// Borrow the full [`FeatureView`] with its lifetime tied to `&self`.
1009        #[must_use]
1010        pub fn view(&self) -> &FeatureView<'_> {
1011            self.0.reborrow()
1012        }
1013        /// Convert to the owned message type.
1014        ///
1015        /// Infallible: this type's constructors wire-decode their
1016        /// buffer, and a view produced by wire decoding always
1017        /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`],
1018        /// whose contract also governs handles converted from a raw
1019        /// [`::buffa::OwnedView`].
1020        #[must_use]
1021        pub fn to_owned_message(&self) -> super::super::super::tile::Feature {
1022            self.0.to_owned_message()
1023        }
1024        /// The underlying bytes buffer.
1025        #[must_use]
1026        pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1027            self.0.bytes()
1028        }
1029        /// Consume the handle, returning the underlying bytes buffer.
1030        #[must_use]
1031        pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1032            self.0.into_bytes()
1033        }
1034        /// Field 1: `id`
1035        #[must_use]
1036        pub fn id(&self) -> ::core::option::Option<u64> {
1037            self.0.reborrow().id
1038        }
1039        /// Tags of this feature are encoded as repeated pairs of
1040        /// integers.
1041        /// A detailed description of tags is located in sections
1042        /// 4.2 and 4.4 of the specification
1043        ///
1044        /// Field 2: `tags`
1045        #[must_use]
1046        pub fn tags(&self) -> &::buffa::RepeatedView<'_, u32> {
1047            &self.0.reborrow().tags
1048        }
1049        /// The type of geometry stored in this feature.
1050        ///
1051        /// Field 3: `type`
1052        #[must_use]
1053        pub fn r#type(
1054            &self,
1055        ) -> ::core::option::Option<super::super::super::tile::GeomType> {
1056            self.0.reborrow().r#type
1057        }
1058        /// Contains a stream of commands and parameters (vertices).
1059        /// A detailed description on geometry encoding is located in
1060        /// section 4.3 of the specification.
1061        ///
1062        /// Field 4: `geometry`
1063        #[must_use]
1064        pub fn geometry(&self) -> &::buffa::RepeatedView<'_, u32> {
1065            &self.0.reborrow().geometry
1066        }
1067    }
1068    impl ::core::convert::From<::buffa::OwnedView<FeatureView<'static>>>
1069    for FeatureOwnedView {
1070        fn from(inner: ::buffa::OwnedView<FeatureView<'static>>) -> Self {
1071            FeatureOwnedView(inner)
1072        }
1073    }
1074    impl ::core::convert::From<FeatureOwnedView>
1075    for ::buffa::OwnedView<FeatureView<'static>> {
1076        fn from(wrapper: FeatureOwnedView) -> Self {
1077            wrapper.0
1078        }
1079    }
1080    impl ::core::convert::AsRef<::buffa::OwnedView<FeatureView<'static>>>
1081    for FeatureOwnedView {
1082        fn as_ref(&self) -> &::buffa::OwnedView<FeatureView<'static>> {
1083            &self.0
1084        }
1085    }
1086    impl ::buffa::HasMessageView for super::super::super::tile::Feature {
1087        type View<'a> = FeatureView<'a>;
1088        type ViewHandle = FeatureOwnedView;
1089    }
1090    #[cfg(feature = "json")]
1091    impl ::serde::Serialize for FeatureOwnedView {
1092        fn serialize<__S: ::serde::Serializer>(
1093            &self,
1094            __s: __S,
1095        ) -> ::core::result::Result<__S::Ok, __S::Error> {
1096            ::serde::Serialize::serialize(&self.0, __s)
1097        }
1098    }
1099    /// Layers are described in section 4.1 of the specification
1100    #[derive(Clone, Debug, Default)]
1101    pub struct LayerView<'a> {
1102        /// Any compliant implementation must first read the version
1103        /// number encoded in this message and choose the correct
1104        /// implementation for this version number before proceeding to
1105        /// decode other parts of this message.
1106        ///
1107        /// Field 15: `version`
1108        pub version: u32,
1109        /// Field 1: `name`
1110        pub name: &'a str,
1111        /// The actual features in this tile.
1112        ///
1113        /// Field 2: `features`
1114        pub features: ::buffa::RepeatedView<
1115            'a,
1116            super::super::super::__buffa::view::tile::FeatureView<'a>,
1117        >,
1118        /// Dictionary encoding for keys
1119        ///
1120        /// Field 3: `keys`
1121        pub keys: ::buffa::RepeatedView<'a, &'a str>,
1122        /// Dictionary encoding for values
1123        ///
1124        /// Field 4: `values`
1125        pub values: ::buffa::RepeatedView<
1126            'a,
1127            super::super::super::__buffa::view::tile::ValueView<'a>,
1128        >,
1129        /// Although this is an "optional" field it is required by the specification.
1130        /// See <https://github.com/mapbox/vector-tile-spec/issues/47>
1131        ///
1132        /// Field 5: `extent`
1133        pub extent: ::core::option::Option<u32>,
1134        #[doc(hidden)]
1135        pub __buffa_required_seen_0: u64,
1136    }
1137    impl<'a> LayerView<'a> {
1138        /**Whether required field `version` was present on the wire.
1139
1140Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/
1141        #[must_use]
1142        #[inline]
1143        pub const fn has_version(&self) -> bool {
1144            self.__buffa_required_seen_0 & 1u64 != 0
1145        }
1146        /**Whether required field `name` was present on the wire.
1147
1148Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/
1149        #[must_use]
1150        #[inline]
1151        pub const fn has_name(&self) -> bool {
1152            self.__buffa_required_seen_0 & 2u64 != 0
1153        }
1154    }
1155    impl<'a> ::buffa::MessageView<'a> for LayerView<'a> {
1156        type Owned = super::super::super::tile::Layer;
1157        fn decode_view(
1158            buf: &'a [u8],
1159        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1160            let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
1161            <Self as ::buffa::MessageView>::decode_view_ctx(
1162                buf,
1163                ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1164            )
1165        }
1166        fn decode_view_with_ctx(
1167            buf: &'a [u8],
1168            ctx: ::buffa::DecodeContext<'_>,
1169        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1170            <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1171        }
1172        #[inline]
1173        fn merge_view_field(
1174            &mut self,
1175            tag: ::buffa::encoding::Tag,
1176            cur: &'a [u8],
1177            _before_tag: &'a [u8],
1178            ctx: ::buffa::DecodeContext<'_>,
1179        ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1180            let _ = ctx;
1181            #[allow(unused_variables)]
1182            let view = self;
1183            let mut cur = cur;
1184            match tag.field_number() {
1185                15u32 => {
1186                    ::buffa::encoding::check_wire_type(
1187                        tag,
1188                        ::buffa::encoding::WireType::Varint,
1189                    )?;
1190                    view.version = ::buffa::types::decode_uint32(&mut cur)?;
1191                    view.__buffa_required_seen_0 |= 1u64;
1192                }
1193                1u32 => {
1194                    ::buffa::encoding::check_wire_type(
1195                        tag,
1196                        ::buffa::encoding::WireType::LengthDelimited,
1197                    )?;
1198                    view.name = ::buffa::types::borrow_str(&mut cur)?;
1199                    view.__buffa_required_seen_0 |= 2u64;
1200                }
1201                5u32 => {
1202                    ::buffa::encoding::check_wire_type(
1203                        tag,
1204                        ::buffa::encoding::WireType::Varint,
1205                    )?;
1206                    view.extent = Some(::buffa::types::decode_uint32(&mut cur)?);
1207                }
1208                2u32 => {
1209                    ::buffa::encoding::check_wire_type(
1210                        tag,
1211                        ::buffa::encoding::WireType::LengthDelimited,
1212                    )?;
1213                    let __sub_ctx = ctx.descend()?;
1214                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1215                    ctx.register_element_memory(
1216                        ::core::mem::size_of::<
1217                            super::super::super::__buffa::view::tile::FeatureView,
1218                        >(),
1219                    )?;
1220                    view.features
1221                        .push(
1222                            <super::super::super::__buffa::view::tile::FeatureView as ::buffa::MessageView>::decode_view_ctx(
1223                                sub,
1224                                __sub_ctx,
1225                            )?,
1226                        );
1227                }
1228                3u32 => {
1229                    ::buffa::encoding::check_wire_type(
1230                        tag,
1231                        ::buffa::encoding::WireType::LengthDelimited,
1232                    )?;
1233                    let __elem = ::buffa::types::borrow_str(&mut cur)?;
1234                    ctx.register_element_memory(
1235                        ::buffa::__private::element_footprint(&__elem),
1236                    )?;
1237                    view.keys.push(__elem);
1238                }
1239                4u32 => {
1240                    ::buffa::encoding::check_wire_type(
1241                        tag,
1242                        ::buffa::encoding::WireType::LengthDelimited,
1243                    )?;
1244                    let __sub_ctx = ctx.descend()?;
1245                    let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1246                    ctx.register_element_memory(
1247                        ::core::mem::size_of::<
1248                            super::super::super::__buffa::view::tile::ValueView,
1249                        >(),
1250                    )?;
1251                    view.values
1252                        .push(
1253                            <super::super::super::__buffa::view::tile::ValueView as ::buffa::MessageView>::decode_view_ctx(
1254                                sub,
1255                                __sub_ctx,
1256                            )?,
1257                        );
1258                }
1259                _ => {
1260                    ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1261                }
1262            }
1263            ::core::result::Result::Ok(cur)
1264        }
1265        fn to_owned_message(
1266            &self,
1267        ) -> ::core::result::Result<
1268            super::super::super::tile::Layer,
1269            ::buffa::DecodeError,
1270        > {
1271            self.to_owned_from_source(None)
1272        }
1273        #[allow(clippy::useless_conversion, clippy::needless_update)]
1274        fn to_owned_from_source(
1275            &self,
1276            __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1277        ) -> ::core::result::Result<
1278            super::super::super::tile::Layer,
1279            ::buffa::DecodeError,
1280        > {
1281            #[allow(unused_imports)]
1282            use ::buffa::alloc::string::ToString as _;
1283            let _ = __buffa_src;
1284            ::core::result::Result::Ok(super::super::super::tile::Layer {
1285                version: self.version,
1286                name: self.name.to_string(),
1287                features: self
1288                    .features
1289                    .iter()
1290                    .map(|v| v.to_owned_from_source(__buffa_src))
1291                    .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
1292                keys: self.keys.iter().map(|s| s.to_string()).collect(),
1293                values: self
1294                    .values
1295                    .iter()
1296                    .map(|v| v.to_owned_from_source(__buffa_src))
1297                    .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
1298                extent: self.extent,
1299                ..::core::default::Default::default()
1300            })
1301        }
1302    }
1303    impl<'a> ::buffa::ViewEncode<'a> for LayerView<'a> {
1304        #[allow(clippy::needless_borrow, clippy::let_and_return)]
1305        fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1306            #[allow(unused_imports)]
1307            use ::buffa::Enumeration as _;
1308            let mut size = 0u64;
1309            size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
1310            for v in &self.features {
1311                let __slot = __cache.reserve();
1312                let inner_size = v.compute_size(__cache);
1313                __cache.set(__slot, inner_size);
1314                size
1315                    += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1316                        + inner_size as u64;
1317            }
1318            for v in &self.keys {
1319                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
1320            }
1321            for v in &self.values {
1322                let __slot = __cache.reserve();
1323                let inner_size = v.compute_size(__cache);
1324                __cache.set(__slot, inner_size);
1325                size
1326                    += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1327                        + inner_size as u64;
1328            }
1329            if let Some(v) = self.extent {
1330                size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64;
1331            }
1332            size += 1u64 + ::buffa::types::uint32_encoded_len(self.version) as u64;
1333            ::buffa::saturate_size(size)
1334        }
1335        #[allow(clippy::needless_borrow)]
1336        fn write_to(
1337            &self,
1338            __cache: &mut ::buffa::SizeCache,
1339            buf: &mut impl ::buffa::EncodeSink,
1340        ) {
1341            #[allow(unused_imports)]
1342            use ::buffa::Enumeration as _;
1343            ::buffa::types::put_string_field(1u32, &self.name, buf);
1344            for v in &self.features {
1345                ::buffa::types::put_len_delimited_header(
1346                    2u32,
1347                    u64::from(__cache.consume_next()),
1348                    buf,
1349                );
1350                v.write_to(__cache, buf);
1351            }
1352            for v in &self.keys {
1353                ::buffa::types::put_string_field(3u32, v, buf);
1354            }
1355            for v in &self.values {
1356                ::buffa::types::put_len_delimited_header(
1357                    4u32,
1358                    u64::from(__cache.consume_next()),
1359                    buf,
1360                );
1361                v.write_to(__cache, buf);
1362            }
1363            if let Some(v) = self.extent {
1364                ::buffa::types::put_uint32_field(5u32, v, buf);
1365            }
1366            ::buffa::types::put_uint32_field(15u32, self.version, buf);
1367        }
1368    }
1369    #[cfg(feature = "json")]
1370    /// Serializes this view as protobuf JSON.
1371    ///
1372    /// Implicit-presence fields with default values are omitted, `required`
1373    /// fields are always emitted, explicit-presence (`optional`) fields are
1374    /// emitted only when set, bytes fields are base64-encoded, and enum
1375    /// values are their proto name strings.
1376    ///
1377    /// This impl uses `serialize_map(None)` because the number of emitted
1378    /// fields depends on default-omission rules; serializers that require
1379    /// known map lengths (e.g. `bincode`) will return a runtime error.
1380    /// Use the owned message type for those formats.
1381    impl<'__a> ::serde::Serialize for LayerView<'__a> {
1382        fn serialize<__S: ::serde::Serializer>(
1383            &self,
1384            __s: __S,
1385        ) -> ::core::result::Result<__S::Ok, __S::Error> {
1386            use ::serde::ser::SerializeMap as _;
1387            let mut __map = __s.serialize_map(::core::option::Option::None)?;
1388            {
1389                __map
1390                    .serialize_entry(
1391                        "version",
1392                        &::buffa::json_helpers::ProtoJson(&self.version),
1393                    )?;
1394            }
1395            {
1396                __map.serialize_entry("name", self.name)?;
1397            }
1398            if !self.features.is_empty() {
1399                __map.serialize_entry("features", &*self.features)?;
1400            }
1401            if !self.keys.is_empty() {
1402                __map.serialize_entry("keys", &*self.keys)?;
1403            }
1404            if !self.values.is_empty() {
1405                __map.serialize_entry("values", &*self.values)?;
1406            }
1407            if let ::core::option::Option::Some(__v) = self.extent {
1408                __map
1409                    .serialize_entry("extent", &::buffa::json_helpers::ProtoJson(&__v))?;
1410            }
1411            __map.end()
1412        }
1413    }
1414    impl<'a> ::buffa::MessageName for LayerView<'a> {
1415        const PACKAGE: &'static str = "vector_tile";
1416        const NAME: &'static str = "Tile.Layer";
1417        const FULL_NAME: &'static str = "vector_tile.Tile.Layer";
1418        const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Layer";
1419    }
1420    ::buffa::impl_default_view_instance!(LayerView);
1421    ::buffa::impl_view_reborrow!(LayerView);
1422    /** Self-contained, `'static` owned view of a `Layer` message.
1423
1424 Wraps [`::buffa::OwnedView`]`<`[`LayerView`]`<'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.
1425
1426 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`LayerView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
1427    #[derive(Clone, Debug)]
1428    pub struct LayerOwnedView(::buffa::OwnedView<LayerView<'static>>);
1429    impl LayerOwnedView {
1430        /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
1431        ///
1432        /// The view borrows directly from the buffer's data; the buffer is
1433        /// retained inside the returned handle.
1434        ///
1435        /// # Errors
1436        ///
1437        /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
1438        /// protobuf data.
1439        pub fn decode(
1440            bytes: ::buffa::bytes::Bytes,
1441        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1442            ::core::result::Result::Ok(
1443                LayerOwnedView(::buffa::OwnedView::decode(bytes)?),
1444            )
1445        }
1446        /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
1447        /// max message size).
1448        ///
1449        /// # Errors
1450        ///
1451        /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
1452        /// exceeds the configured limits.
1453        pub fn decode_with_options(
1454            bytes: ::buffa::bytes::Bytes,
1455            opts: &::buffa::DecodeOptions,
1456        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1457            ::core::result::Result::Ok(
1458                LayerOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1459            )
1460        }
1461        /// Build from an owned message via an encode → decode round-trip.
1462        ///
1463        /// # Errors
1464        ///
1465        /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the
1466        /// message's encoded size exceeds the 2 GiB protobuf limit, or
1467        /// another [`::buffa::DecodeError`] if the re-encoded bytes are
1468        /// somehow invalid (should not happen for well-formed messages).
1469        pub fn from_owned(
1470            msg: &super::super::super::tile::Layer,
1471        ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1472            ::core::result::Result::Ok(
1473                LayerOwnedView(::buffa::OwnedView::from_owned(msg)?),
1474            )
1475        }
1476        /// Borrow the full [`LayerView`] with its lifetime tied to `&self`.
1477        #[must_use]
1478        pub fn view(&self) -> &LayerView<'_> {
1479            self.0.reborrow()
1480        }
1481        /// Convert to the owned message type.
1482        ///
1483        /// Infallible: this type's constructors wire-decode their
1484        /// buffer, and a view produced by wire decoding always
1485        /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`],
1486        /// whose contract also governs handles converted from a raw
1487        /// [`::buffa::OwnedView`].
1488        #[must_use]
1489        pub fn to_owned_message(&self) -> super::super::super::tile::Layer {
1490            self.0.to_owned_message()
1491        }
1492        /// The underlying bytes buffer.
1493        #[must_use]
1494        pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1495            self.0.bytes()
1496        }
1497        /// Consume the handle, returning the underlying bytes buffer.
1498        #[must_use]
1499        pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1500            self.0.into_bytes()
1501        }
1502        /// Any compliant implementation must first read the version
1503        /// number encoded in this message and choose the correct
1504        /// implementation for this version number before proceeding to
1505        /// decode other parts of this message.
1506        ///
1507        /// Field 15: `version`
1508        #[must_use]
1509        pub fn version(&self) -> u32 {
1510            self.0.reborrow().version
1511        }
1512        /// Field 1: `name`
1513        #[must_use]
1514        pub fn name(&self) -> &'_ str {
1515            self.0.reborrow().name
1516        }
1517        /// The actual features in this tile.
1518        ///
1519        /// Field 2: `features`
1520        #[must_use]
1521        pub fn features(
1522            &self,
1523        ) -> &::buffa::RepeatedView<
1524            '_,
1525            super::super::super::__buffa::view::tile::FeatureView<'_>,
1526        > {
1527            &self.0.reborrow().features
1528        }
1529        /// Dictionary encoding for keys
1530        ///
1531        /// Field 3: `keys`
1532        #[must_use]
1533        pub fn keys(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
1534            &self.0.reborrow().keys
1535        }
1536        /// Dictionary encoding for values
1537        ///
1538        /// Field 4: `values`
1539        #[must_use]
1540        pub fn values(
1541            &self,
1542        ) -> &::buffa::RepeatedView<
1543            '_,
1544            super::super::super::__buffa::view::tile::ValueView<'_>,
1545        > {
1546            &self.0.reborrow().values
1547        }
1548        /// Although this is an "optional" field it is required by the specification.
1549        /// See <https://github.com/mapbox/vector-tile-spec/issues/47>
1550        ///
1551        /// Field 5: `extent`
1552        #[must_use]
1553        pub fn extent(&self) -> ::core::option::Option<u32> {
1554            self.0.reborrow().extent
1555        }
1556    }
1557    impl ::core::convert::From<::buffa::OwnedView<LayerView<'static>>>
1558    for LayerOwnedView {
1559        fn from(inner: ::buffa::OwnedView<LayerView<'static>>) -> Self {
1560            LayerOwnedView(inner)
1561        }
1562    }
1563    impl ::core::convert::From<LayerOwnedView>
1564    for ::buffa::OwnedView<LayerView<'static>> {
1565        fn from(wrapper: LayerOwnedView) -> Self {
1566            wrapper.0
1567        }
1568    }
1569    impl ::core::convert::AsRef<::buffa::OwnedView<LayerView<'static>>>
1570    for LayerOwnedView {
1571        fn as_ref(&self) -> &::buffa::OwnedView<LayerView<'static>> {
1572            &self.0
1573        }
1574    }
1575    impl ::buffa::HasMessageView for super::super::super::tile::Layer {
1576        type View<'a> = LayerView<'a>;
1577        type ViewHandle = LayerOwnedView;
1578    }
1579    #[cfg(feature = "json")]
1580    impl ::serde::Serialize for LayerOwnedView {
1581        fn serialize<__S: ::serde::Serializer>(
1582            &self,
1583            __s: __S,
1584        ) -> ::core::result::Result<__S::Ok, __S::Error> {
1585            ::serde::Serialize::serialize(&self.0, __s)
1586        }
1587    }
1588}