fast-mvt 0.6.0

Fast Mapbox Vector Tile (MVT) reader and writer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
// @generated by buffa-codegen. DO NOT EDIT.
// source: vector_tile.proto

#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "json", serde(default))]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Tile {
    /// Field 3: `layers`
    #[cfg_attr(
        feature = "json",
        serde(
            rename = "layers",
            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
            deserialize_with = "::buffa::json_helpers::null_as_default"
        )
    )]
    pub layers: ::buffa::alloc::vec::Vec<tile::Layer>,
}
impl ::core::fmt::Debug for Tile {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Tile").field("layers", &self.layers).finish()
    }
}
impl Tile {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile";
}
::buffa::impl_default_instance!(Tile);
impl ::buffa::MessageName for Tile {
    const PACKAGE: &'static str = "vector_tile";
    const NAME: &'static str = "Tile";
    const FULL_NAME: &'static str = "vector_tile.Tile";
    const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile";
}
impl ::buffa::Message for Tile {
    /// Returns the total encoded size in bytes.
    ///
    /// Accumulates in `u64` (which cannot overflow for in-memory
    /// data) and saturates to `u32` at return, so a message whose
    /// encoded size exceeds the 2 GiB protobuf limit yields a value
    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
    /// points reject, never a silently wrapped size.
    #[allow(clippy::let_and_return)]
    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u64;
        for v in &self.layers {
            let __slot = __cache.reserve();
            let inner_size = v.compute_size(__cache);
            __cache.set(__slot, inner_size);
            size
                += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
                    + inner_size as u64;
        }
        ::buffa::saturate_size(size)
    }
    fn write_to(
        &self,
        __cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        for v in &self.layers {
            ::buffa::types::put_len_delimited_header(
                3u32,
                u64::from(__cache.consume_next()),
                buf,
            );
            v.write_to(__cache, buf);
        }
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            3u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                let mut elem = ::core::default::Default::default();
                ctx.register_element_memory(
                    ::buffa::__private::element_footprint(&elem),
                )?;
                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
                self.layers.push(elem);
            }
            _ => {
                ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
            }
        }
        ::core::result::Result::Ok(())
    }
    fn clear(&mut self) {
        self.layers.clear();
    }
}
#[cfg(feature = "json")]
impl ::buffa::json_helpers::ProtoElemJson for Tile {
    fn serialize_proto_json<S: ::serde::Serializer>(
        v: &Self,
        s: S,
    ) -> ::core::result::Result<S::Ok, S::Error> {
        ::serde::Serialize::serialize(v, s)
    }
    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
        d: D,
    ) -> ::core::result::Result<Self, D::Error> {
        <Self as ::serde::Deserialize>::deserialize(d)
    }
}
#[cfg(feature = "json")]
#[doc(hidden)]
pub const __TILE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
    type_url: "type.googleapis.com/vector_tile.Tile",
    to_json: ::buffa::type_registry::any_to_json::<Tile>,
    from_json: ::buffa::type_registry::any_from_json::<Tile>,
    is_wkt: false,
};
pub mod tile {
    #[allow(unused_imports)]
    use super::*;
    /// GeomType is described in section 4.3.4 of the specification
    #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
    #[repr(i32)]
    pub enum GeomType {
        UNKNOWN = 0i32,
        POINT = 1i32,
        LINESTRING = 2i32,
        POLYGON = 3i32,
    }
    impl GeomType {
        ///Idiomatic alias for [`Self::UNKNOWN`]; `Debug` prints the variant name.
        #[allow(non_upper_case_globals)]
        pub const Unknown: Self = Self::UNKNOWN;
        ///Idiomatic alias for [`Self::POINT`]; `Debug` prints the variant name.
        #[allow(non_upper_case_globals)]
        pub const Point: Self = Self::POINT;
        ///Idiomatic alias for [`Self::LINESTRING`]; `Debug` prints the variant name.
        #[allow(non_upper_case_globals)]
        pub const Linestring: Self = Self::LINESTRING;
        ///Idiomatic alias for [`Self::POLYGON`]; `Debug` prints the variant name.
        #[allow(non_upper_case_globals)]
        pub const Polygon: Self = Self::POLYGON;
    }
    impl ::core::default::Default for GeomType {
        fn default() -> Self {
            Self::UNKNOWN
        }
    }
    #[cfg(feature = "json")]
    const _: () = {
        impl ::serde::Serialize for GeomType {
            fn serialize<S: ::serde::Serializer>(
                &self,
                s: S,
            ) -> ::core::result::Result<S::Ok, S::Error> {
                s.serialize_str(::buffa::Enumeration::proto_name(self))
            }
        }
        impl<'de> ::serde::Deserialize<'de> for GeomType {
            fn deserialize<D: ::serde::Deserializer<'de>>(
                d: D,
            ) -> ::core::result::Result<Self, D::Error> {
                struct _V;
                impl ::serde::de::Visitor<'_> for _V {
                    type Value = GeomType;
                    fn expecting(
                        &self,
                        f: &mut ::core::fmt::Formatter<'_>,
                    ) -> ::core::fmt::Result {
                        f.write_str(
                            concat!(
                                "a string, integer, or null for ", stringify!(GeomType)
                            ),
                        )
                    }
                    fn visit_str<E: ::serde::de::Error>(
                        self,
                        v: &str,
                    ) -> ::core::result::Result<GeomType, E> {
                        <GeomType as ::buffa::Enumeration>::from_proto_name(v)
                            .ok_or_else(|| {
                                ::serde::de::Error::unknown_variant(v, &[])
                            })
                    }
                    fn visit_i64<E: ::serde::de::Error>(
                        self,
                        v: i64,
                    ) -> ::core::result::Result<GeomType, E> {
                        let v32 = i32::try_from(v)
                            .map_err(|_| {
                                ::serde::de::Error::custom(
                                    ::buffa::alloc::format!("enum value {v} out of i32 range"),
                                )
                            })?;
                        <GeomType as ::buffa::Enumeration>::from_i32(v32)
                            .ok_or_else(|| {
                                ::serde::de::Error::custom(
                                    ::buffa::alloc::format!("unknown enum value {v32}"),
                                )
                            })
                    }
                    fn visit_u64<E: ::serde::de::Error>(
                        self,
                        v: u64,
                    ) -> ::core::result::Result<GeomType, E> {
                        let v32 = i32::try_from(v)
                            .map_err(|_| {
                                ::serde::de::Error::custom(
                                    ::buffa::alloc::format!("enum value {v} out of i32 range"),
                                )
                            })?;
                        <GeomType as ::buffa::Enumeration>::from_i32(v32)
                            .ok_or_else(|| {
                                ::serde::de::Error::custom(
                                    ::buffa::alloc::format!("unknown enum value {v32}"),
                                )
                            })
                    }
                    fn visit_unit<E: ::serde::de::Error>(
                        self,
                    ) -> ::core::result::Result<GeomType, E> {
                        ::core::result::Result::Ok(::core::default::Default::default())
                    }
                }
                d.deserialize_any(_V)
            }
        }
        impl ::buffa::json_helpers::ProtoElemJson for GeomType {
            fn serialize_proto_json<S: ::serde::Serializer>(
                v: &Self,
                s: S,
            ) -> ::core::result::Result<S::Ok, S::Error> {
                ::serde::Serialize::serialize(v, s)
            }
            fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
                d: D,
            ) -> ::core::result::Result<Self, D::Error> {
                <Self as ::serde::Deserialize>::deserialize(d)
            }
        }
    };
    impl ::buffa::Enumeration for GeomType {
        fn from_i32(value: i32) -> ::core::option::Option<Self> {
            match value {
                0i32 => ::core::option::Option::Some(Self::UNKNOWN),
                1i32 => ::core::option::Option::Some(Self::POINT),
                2i32 => ::core::option::Option::Some(Self::LINESTRING),
                3i32 => ::core::option::Option::Some(Self::POLYGON),
                _ => ::core::option::Option::None,
            }
        }
        fn to_i32(&self) -> i32 {
            *self as i32
        }
        fn proto_name(&self) -> &'static str {
            match self {
                Self::UNKNOWN => "UNKNOWN",
                Self::POINT => "POINT",
                Self::LINESTRING => "LINESTRING",
                Self::POLYGON => "POLYGON",
            }
        }
        fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
            match name {
                "UNKNOWN" => ::core::option::Option::Some(Self::UNKNOWN),
                "POINT" => ::core::option::Option::Some(Self::POINT),
                "LINESTRING" => ::core::option::Option::Some(Self::LINESTRING),
                "POLYGON" => ::core::option::Option::Some(Self::POLYGON),
                _ => ::core::option::Option::None,
            }
        }
        fn values() -> &'static [Self] {
            &[Self::UNKNOWN, Self::POINT, Self::LINESTRING, Self::POLYGON]
        }
    }
    /// Variant type encoding
    /// The use of values is described in section 4.1 of the specification
    #[derive(Clone, PartialEq, Default)]
    #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
    #[cfg_attr(feature = "json", serde(default))]
    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
    pub struct Value {
        /// Exactly one of these values must be present in a valid message
        ///
        /// Field 1: `string_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "stringValue",
                alias = "string_value",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub string_value: ::core::option::Option<::buffa::alloc::string::String>,
        /// Field 2: `float_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "floatValue",
                alias = "float_value",
                with = "::buffa::json_helpers::opt_float",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub float_value: ::core::option::Option<f32>,
        /// Field 3: `double_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "doubleValue",
                alias = "double_value",
                with = "::buffa::json_helpers::opt_double",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub double_value: ::core::option::Option<f64>,
        /// Field 4: `int_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "intValue",
                alias = "int_value",
                with = "::buffa::json_helpers::opt_int64",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub int_value: ::core::option::Option<i64>,
        /// Field 5: `uint_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "uintValue",
                alias = "uint_value",
                with = "::buffa::json_helpers::opt_uint64",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub uint_value: ::core::option::Option<u64>,
        /// Field 6: `sint_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "sintValue",
                alias = "sint_value",
                with = "::buffa::json_helpers::opt_int64",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub sint_value: ::core::option::Option<i64>,
        /// Field 7: `bool_value`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "boolValue",
                alias = "bool_value",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub bool_value: ::core::option::Option<bool>,
    }
    impl ::core::fmt::Debug for Value {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("Value")
                .field("string_value", &self.string_value)
                .field("float_value", &self.float_value)
                .field("double_value", &self.double_value)
                .field("int_value", &self.int_value)
                .field("uint_value", &self.uint_value)
                .field("sint_value", &self.sint_value)
                .field("bool_value", &self.bool_value)
                .finish()
        }
    }
    impl Value {
        /// Protobuf type URL for this message, for use with `Any::pack` and
        /// `Any::unpack_if`.
        ///
        /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
        pub const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Value";
    }
    impl Value {
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::string_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_string_value(
            mut self,
            value: impl Into<::buffa::alloc::string::String>,
        ) -> Self {
            self.string_value = Some(value.into());
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::float_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_float_value(mut self, value: f32) -> Self {
            self.float_value = Some(value);
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::double_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_double_value(mut self, value: f64) -> Self {
            self.double_value = Some(value);
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::int_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_int_value(mut self, value: i64) -> Self {
            self.int_value = Some(value);
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::uint_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_uint_value(mut self, value: u64) -> Self {
            self.uint_value = Some(value);
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::sint_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_sint_value(mut self, value: i64) -> Self {
            self.sint_value = Some(value);
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::bool_value`] to `Some(value)`, consuming and returning `self`.
        pub fn with_bool_value(mut self, value: bool) -> Self {
            self.bool_value = Some(value);
            self
        }
    }
    ::buffa::impl_default_instance!(Value);
    impl ::buffa::MessageName for Value {
        const PACKAGE: &'static str = "vector_tile";
        const NAME: &'static str = "Tile.Value";
        const FULL_NAME: &'static str = "vector_tile.Tile.Value";
        const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Value";
    }
    impl ::buffa::Message for Value {
        /// Returns the total encoded size in bytes.
        ///
        /// Accumulates in `u64` (which cannot overflow for in-memory
        /// data) and saturates to `u32` at return, so a message whose
        /// encoded size exceeds the 2 GiB protobuf limit yields a value
        /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
        /// points reject, never a silently wrapped size.
        #[allow(clippy::let_and_return)]
        fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            let mut size = 0u64;
            if let Some(ref v) = self.string_value {
                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
            }
            if self.float_value.is_some() {
                size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64;
            }
            if self.double_value.is_some() {
                size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64;
            }
            if let Some(v) = self.int_value {
                size += 1u64 + ::buffa::types::int64_encoded_len(v) as u64;
            }
            if let Some(v) = self.uint_value {
                size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64;
            }
            if let Some(v) = self.sint_value {
                size += 1u64 + ::buffa::types::sint64_encoded_len(v) as u64;
            }
            if self.bool_value.is_some() {
                size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
            }
            ::buffa::saturate_size(size)
        }
        fn write_to(
            &self,
            _cache: &mut ::buffa::SizeCache,
            buf: &mut impl ::buffa::EncodeSink,
        ) {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            if let Some(ref v) = self.string_value {
                ::buffa::types::put_string_field(1u32, v, buf);
            }
            if let Some(v) = self.float_value {
                ::buffa::types::put_float_field(2u32, v, buf);
            }
            if let Some(v) = self.double_value {
                ::buffa::types::put_double_field(3u32, v, buf);
            }
            if let Some(v) = self.int_value {
                ::buffa::types::put_int64_field(4u32, v, buf);
            }
            if let Some(v) = self.uint_value {
                ::buffa::types::put_uint64_field(5u32, v, buf);
            }
            if let Some(v) = self.sint_value {
                ::buffa::types::put_sint64_field(6u32, v, buf);
            }
            if let Some(v) = self.bool_value {
                ::buffa::types::put_bool_field(7u32, v, buf);
            }
        }
        fn merge_field(
            &mut self,
            tag: ::buffa::encoding::Tag,
            buf: &mut impl ::buffa::bytes::Buf,
            ctx: ::buffa::DecodeContext<'_>,
        ) -> ::core::result::Result<(), ::buffa::DecodeError> {
            #[allow(unused_imports)]
            use ::buffa::bytes::Buf as _;
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            match tag.field_number() {
                1u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )?;
                    ::buffa::types::merge_string(
                        self
                            .string_value
                            .get_or_insert_with(::buffa::alloc::string::String::new),
                        buf,
                    )?;
                }
                2u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Fixed32,
                    )?;
                    self.float_value = ::core::option::Option::Some(
                        ::buffa::types::decode_float(buf)?,
                    );
                }
                3u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Fixed64,
                    )?;
                    self.double_value = ::core::option::Option::Some(
                        ::buffa::types::decode_double(buf)?,
                    );
                }
                4u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.int_value = ::core::option::Option::Some(
                        ::buffa::types::decode_int64(buf)?,
                    );
                }
                5u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.uint_value = ::core::option::Option::Some(
                        ::buffa::types::decode_uint64(buf)?,
                    );
                }
                6u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.sint_value = ::core::option::Option::Some(
                        ::buffa::types::decode_sint64(buf)?,
                    );
                }
                7u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.bool_value = ::core::option::Option::Some(
                        ::buffa::types::decode_bool(buf)?,
                    );
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
                }
            }
            ::core::result::Result::Ok(())
        }
        fn clear(&mut self) {
            self.string_value = ::core::option::Option::None;
            self.float_value = ::core::option::Option::None;
            self.double_value = ::core::option::Option::None;
            self.int_value = ::core::option::Option::None;
            self.uint_value = ::core::option::Option::None;
            self.sint_value = ::core::option::Option::None;
            self.bool_value = ::core::option::Option::None;
        }
    }
    #[cfg(feature = "json")]
    impl ::buffa::json_helpers::ProtoElemJson for Value {
        fn serialize_proto_json<S: ::serde::Serializer>(
            v: &Self,
            s: S,
        ) -> ::core::result::Result<S::Ok, S::Error> {
            ::serde::Serialize::serialize(v, s)
        }
        fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
            d: D,
        ) -> ::core::result::Result<Self, D::Error> {
            <Self as ::serde::Deserialize>::deserialize(d)
        }
    }
    #[cfg(feature = "json")]
    #[doc(hidden)]
    pub const __VALUE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/vector_tile.Tile.Value",
        to_json: ::buffa::type_registry::any_to_json::<Value>,
        from_json: ::buffa::type_registry::any_from_json::<Value>,
        is_wkt: false,
    };
    /// Features are described in section 4.2 of the specification
    #[derive(Clone, PartialEq, Default)]
    #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
    #[cfg_attr(feature = "json", serde(default))]
    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
    pub struct Feature {
        /// Field 1: `id`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "id",
                with = "::buffa::json_helpers::opt_uint64",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub id: ::core::option::Option<u64>,
        /// Tags of this feature are encoded as repeated pairs of
        /// integers.
        /// A detailed description of tags is located in sections
        /// 4.2 and 4.4 of the specification
        ///
        /// Field 2: `tags`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "tags",
                skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
                deserialize_with = "::buffa::json_helpers::null_as_default"
            )
        )]
        pub tags: ::buffa::alloc::vec::Vec<u32>,
        /// The type of geometry stored in this feature.
        ///
        /// Field 3: `type`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "type",
                with = "::buffa::json_helpers::opt_closed_enum",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub r#type: ::core::option::Option<super::tile::GeomType>,
        /// Contains a stream of commands and parameters (vertices).
        /// A detailed description on geometry encoding is located in
        /// section 4.3 of the specification.
        ///
        /// Field 4: `geometry`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "geometry",
                skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
                deserialize_with = "::buffa::json_helpers::null_as_default"
            )
        )]
        pub geometry: ::buffa::alloc::vec::Vec<u32>,
    }
    impl ::core::fmt::Debug for Feature {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("Feature")
                .field("id", &self.id)
                .field("tags", &self.tags)
                .field("type", &self.r#type)
                .field("geometry", &self.geometry)
                .finish()
        }
    }
    impl Feature {
        /// Protobuf type URL for this message, for use with `Any::pack` and
        /// `Any::unpack_if`.
        ///
        /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
        pub const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Feature";
    }
    impl Feature {
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::id`] to `Some(value)`, consuming and returning `self`.
        pub fn with_id(mut self, value: u64) -> Self {
            self.id = Some(value);
            self
        }
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets `type` to `Some(value)`, consuming and returning `self`.
        pub fn with_type(mut self, value: impl Into<super::tile::GeomType>) -> Self {
            self.r#type = Some(value.into());
            self
        }
    }
    ::buffa::impl_default_instance!(Feature);
    impl ::buffa::MessageName for Feature {
        const PACKAGE: &'static str = "vector_tile";
        const NAME: &'static str = "Tile.Feature";
        const FULL_NAME: &'static str = "vector_tile.Tile.Feature";
        const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Feature";
    }
    impl ::buffa::Message for Feature {
        /// Returns the total encoded size in bytes.
        ///
        /// Accumulates in `u64` (which cannot overflow for in-memory
        /// data) and saturates to `u32` at return, so a message whose
        /// encoded size exceeds the 2 GiB protobuf limit yields a value
        /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
        /// points reject, never a silently wrapped size.
        #[allow(clippy::let_and_return)]
        fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            let mut size = 0u64;
            if let Some(v) = self.id {
                size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64;
            }
            if !self.tags.is_empty() {
                let payload: u64 = self
                    .tags
                    .iter()
                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
                    .sum::<u64>();
                size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload;
            }
            if let Some(ref v) = self.r#type {
                size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64;
            }
            if !self.geometry.is_empty() {
                let payload: u64 = self
                    .geometry
                    .iter()
                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
                    .sum::<u64>();
                size += 1u64 + ::buffa::encoding::varint_len(payload) as u64 + payload;
            }
            ::buffa::saturate_size(size)
        }
        fn write_to(
            &self,
            _cache: &mut ::buffa::SizeCache,
            buf: &mut impl ::buffa::EncodeSink,
        ) {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            if let Some(v) = self.id {
                ::buffa::types::put_uint64_field(1u32, v, buf);
            }
            if !self.tags.is_empty() {
                let payload: u64 = self
                    .tags
                    .iter()
                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
                    .sum::<u64>();
                ::buffa::types::put_len_delimited_header(2u32, payload, buf);
                for &v in &self.tags {
                    ::buffa::types::encode_uint32(v, buf);
                }
            }
            if let Some(ref v) = self.r#type {
                ::buffa::types::put_int32_field(3u32, v.to_i32(), buf);
            }
            if !self.geometry.is_empty() {
                let payload: u64 = self
                    .geometry
                    .iter()
                    .map(|&v| ::buffa::types::uint32_encoded_len(v) as u64)
                    .sum::<u64>();
                ::buffa::types::put_len_delimited_header(4u32, payload, buf);
                for &v in &self.geometry {
                    ::buffa::types::encode_uint32(v, buf);
                }
            }
        }
        fn merge_field(
            &mut self,
            tag: ::buffa::encoding::Tag,
            buf: &mut impl ::buffa::bytes::Buf,
            ctx: ::buffa::DecodeContext<'_>,
        ) -> ::core::result::Result<(), ::buffa::DecodeError> {
            #[allow(unused_imports)]
            use ::buffa::bytes::Buf as _;
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            match tag.field_number() {
                1u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.id = ::core::option::Option::Some(
                        ::buffa::types::decode_uint64(buf)?,
                    );
                }
                2u32 => {
                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                        let len = ::buffa::encoding::decode_varint(buf)?;
                        let len = usize::try_from(len)
                            .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
                        if buf.remaining() < len {
                            return ::core::result::Result::Err(
                                ::buffa::DecodeError::UnexpectedEof,
                            );
                        }
                        if buf.chunk().len() >= len {
                            ::buffa::types::extend_packed_uint32(
                                &buf.chunk()[..len],
                                &mut self.tags,
                                len,
                            )?;
                            buf.advance(len);
                        } else {
                            self.tags.reserve(len);
                            let mut limited = buf.take(len);
                            while limited.has_remaining() {
                                self.tags
                                    .push(::buffa::types::decode_uint32_packed(&mut limited)?);
                            }
                            let leftover = limited.remaining();
                            if leftover > 0 {
                                limited.advance(leftover);
                            }
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        self.tags.push(::buffa::types::decode_uint32(buf)?);
                    } else {
                        return ::core::result::Result::Err(
                            ::buffa::encoding::wire_type_mismatch(
                                tag,
                                ::buffa::encoding::WireType::LengthDelimited,
                            ),
                        );
                    }
                }
                3u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    let __raw = ::buffa::types::decode_int32(buf)?;
                    if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
                        __raw,
                    ) {
                        self.r#type = ::core::option::Option::Some(__v);
                    }
                }
                4u32 => {
                    if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
                        let len = ::buffa::encoding::decode_varint(buf)?;
                        let len = usize::try_from(len)
                            .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
                        if buf.remaining() < len {
                            return ::core::result::Result::Err(
                                ::buffa::DecodeError::UnexpectedEof,
                            );
                        }
                        if buf.chunk().len() >= len {
                            ::buffa::types::extend_packed_uint32(
                                &buf.chunk()[..len],
                                &mut self.geometry,
                                len,
                            )?;
                            buf.advance(len);
                        } else {
                            self.geometry.reserve(len);
                            let mut limited = buf.take(len);
                            while limited.has_remaining() {
                                self.geometry
                                    .push(::buffa::types::decode_uint32_packed(&mut limited)?);
                            }
                            let leftover = limited.remaining();
                            if leftover > 0 {
                                limited.advance(leftover);
                            }
                        }
                    } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
                        self.geometry.push(::buffa::types::decode_uint32(buf)?);
                    } else {
                        return ::core::result::Result::Err(
                            ::buffa::encoding::wire_type_mismatch(
                                tag,
                                ::buffa::encoding::WireType::LengthDelimited,
                            ),
                        );
                    }
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
                }
            }
            ::core::result::Result::Ok(())
        }
        fn clear(&mut self) {
            self.id = ::core::option::Option::None;
            self.tags.clear();
            self.r#type = ::core::option::Option::None;
            self.geometry.clear();
        }
    }
    #[cfg(feature = "json")]
    impl ::buffa::json_helpers::ProtoElemJson for Feature {
        fn serialize_proto_json<S: ::serde::Serializer>(
            v: &Self,
            s: S,
        ) -> ::core::result::Result<S::Ok, S::Error> {
            ::serde::Serialize::serialize(v, s)
        }
        fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
            d: D,
        ) -> ::core::result::Result<Self, D::Error> {
            <Self as ::serde::Deserialize>::deserialize(d)
        }
    }
    #[cfg(feature = "json")]
    #[doc(hidden)]
    pub const __FEATURE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/vector_tile.Tile.Feature",
        to_json: ::buffa::type_registry::any_to_json::<Feature>,
        from_json: ::buffa::type_registry::any_from_json::<Feature>,
        is_wkt: false,
    };
    /// Layers are described in section 4.1 of the specification
    #[derive(Clone, PartialEq)]
    #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
    #[cfg_attr(feature = "json", serde(default))]
    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
    pub struct Layer {
        /// Any compliant implementation must first read the version
        /// number encoded in this message and choose the correct
        /// implementation for this version number before proceeding to
        /// decode other parts of this message.
        ///
        /// Field 15: `version`
        #[cfg_attr(
            feature = "json",
            serde(rename = "version", with = "::buffa::json_helpers::uint32")
        )]
        pub version: u32,
        /// Field 1: `name`
        #[cfg_attr(
            feature = "json",
            serde(rename = "name", with = "::buffa::json_helpers::proto_string")
        )]
        pub name: ::buffa::alloc::string::String,
        /// The actual features in this tile.
        ///
        /// Field 2: `features`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "features",
                skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
                deserialize_with = "::buffa::json_helpers::null_as_default"
            )
        )]
        pub features: ::buffa::alloc::vec::Vec<super::tile::Feature>,
        /// Dictionary encoding for keys
        ///
        /// Field 3: `keys`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "keys",
                skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
                deserialize_with = "::buffa::json_helpers::null_as_default"
            )
        )]
        pub keys: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
        /// Dictionary encoding for values
        ///
        /// Field 4: `values`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "values",
                skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
                deserialize_with = "::buffa::json_helpers::null_as_default"
            )
        )]
        pub values: ::buffa::alloc::vec::Vec<super::tile::Value>,
        /// Although this is an "optional" field it is required by the specification.
        /// See <https://github.com/mapbox/vector-tile-spec/issues/47>
        ///
        /// Field 5: `extent`
        #[cfg_attr(
            feature = "json",
            serde(
                rename = "extent",
                with = "::buffa::json_helpers::opt_uint32",
                skip_serializing_if = "::core::option::Option::is_none"
            )
        )]
        pub extent: ::core::option::Option<u32>,
    }
    impl ::core::fmt::Debug for Layer {
        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
            f.debug_struct("Layer")
                .field("version", &self.version)
                .field("name", &self.name)
                .field("features", &self.features)
                .field("keys", &self.keys)
                .field("values", &self.values)
                .field("extent", &self.extent)
                .finish()
        }
    }
    impl ::core::default::Default for Layer {
        fn default() -> Self {
            Self {
                version: 1u32,
                name: ::core::default::Default::default(),
                features: ::core::default::Default::default(),
                keys: ::core::default::Default::default(),
                values: ::core::default::Default::default(),
                extent: ::core::default::Default::default(),
            }
        }
    }
    impl Layer {
        /// Protobuf type URL for this message, for use with `Any::pack` and
        /// `Any::unpack_if`.
        ///
        /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
        pub const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Layer";
    }
    impl Layer {
        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
        #[inline]
        ///Sets [`Self::extent`] to `Some(value)`, consuming and returning `self`.
        pub fn with_extent(mut self, value: u32) -> Self {
            self.extent = Some(value);
            self
        }
    }
    ::buffa::impl_default_instance!(Layer);
    impl ::buffa::MessageName for Layer {
        const PACKAGE: &'static str = "vector_tile";
        const NAME: &'static str = "Tile.Layer";
        const FULL_NAME: &'static str = "vector_tile.Tile.Layer";
        const TYPE_URL: &'static str = "type.googleapis.com/vector_tile.Tile.Layer";
    }
    impl ::buffa::Message for Layer {
        /// Returns the total encoded size in bytes.
        ///
        /// Accumulates in `u64` (which cannot overflow for in-memory
        /// data) and saturates to `u32` at return, so a message whose
        /// encoded size exceeds the 2 GiB protobuf limit yields a value
        /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
        /// points reject, never a silently wrapped size.
        #[allow(clippy::let_and_return)]
        fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            let mut size = 0u64;
            size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
            for v in &self.features {
                let __slot = __cache.reserve();
                let inner_size = v.compute_size(__cache);
                __cache.set(__slot, inner_size);
                size
                    += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
                        + inner_size as u64;
            }
            for v in &self.keys {
                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
            }
            for v in &self.values {
                let __slot = __cache.reserve();
                let inner_size = v.compute_size(__cache);
                __cache.set(__slot, inner_size);
                size
                    += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
                        + inner_size as u64;
            }
            if let Some(v) = self.extent {
                size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64;
            }
            size += 1u64 + ::buffa::types::uint32_encoded_len(self.version) as u64;
            ::buffa::saturate_size(size)
        }
        fn write_to(
            &self,
            __cache: &mut ::buffa::SizeCache,
            buf: &mut impl ::buffa::EncodeSink,
        ) {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            ::buffa::types::put_string_field(1u32, &self.name, buf);
            for v in &self.features {
                ::buffa::types::put_len_delimited_header(
                    2u32,
                    u64::from(__cache.consume_next()),
                    buf,
                );
                v.write_to(__cache, buf);
            }
            for v in &self.keys {
                ::buffa::types::put_string_field(3u32, v, buf);
            }
            for v in &self.values {
                ::buffa::types::put_len_delimited_header(
                    4u32,
                    u64::from(__cache.consume_next()),
                    buf,
                );
                v.write_to(__cache, buf);
            }
            if let Some(v) = self.extent {
                ::buffa::types::put_uint32_field(5u32, v, buf);
            }
            ::buffa::types::put_uint32_field(15u32, self.version, buf);
        }
        fn merge_field(
            &mut self,
            tag: ::buffa::encoding::Tag,
            buf: &mut impl ::buffa::bytes::Buf,
            ctx: ::buffa::DecodeContext<'_>,
        ) -> ::core::result::Result<(), ::buffa::DecodeError> {
            #[allow(unused_imports)]
            use ::buffa::bytes::Buf as _;
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            match tag.field_number() {
                1u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )?;
                    ::buffa::types::merge_string(&mut self.name, buf)?;
                }
                2u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )?;
                    let mut elem = ::core::default::Default::default();
                    ctx.register_element_memory(
                        ::buffa::__private::element_footprint(&elem),
                    )?;
                    ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
                    self.features.push(elem);
                }
                3u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )?;
                    let __elem = ::buffa::types::decode_string(buf)?;
                    ctx.register_element_memory(
                        ::buffa::__private::element_footprint(&__elem),
                    )?;
                    self.keys.push(__elem);
                }
                4u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::LengthDelimited,
                    )?;
                    let mut elem = ::core::default::Default::default();
                    ctx.register_element_memory(
                        ::buffa::__private::element_footprint(&elem),
                    )?;
                    ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
                    self.values.push(elem);
                }
                5u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.extent = ::core::option::Option::Some(
                        ::buffa::types::decode_uint32(buf)?,
                    );
                }
                15u32 => {
                    ::buffa::encoding::check_wire_type(
                        tag,
                        ::buffa::encoding::WireType::Varint,
                    )?;
                    self.version = ::buffa::types::decode_uint32(buf)?;
                }
                _ => {
                    ::buffa::encoding::skip_field_depth(tag, buf, ctx.depth())?;
                }
            }
            ::core::result::Result::Ok(())
        }
        fn clear(&mut self) {
            self.name.clear();
            self.features.clear();
            self.keys.clear();
            self.values.clear();
            self.extent = ::core::option::Option::None;
            self.version = 1u32;
        }
    }
    #[cfg(feature = "json")]
    impl ::buffa::json_helpers::ProtoElemJson for Layer {
        fn serialize_proto_json<S: ::serde::Serializer>(
            v: &Self,
            s: S,
        ) -> ::core::result::Result<S::Ok, S::Error> {
            ::serde::Serialize::serialize(v, s)
        }
        fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
            d: D,
        ) -> ::core::result::Result<Self, D::Error> {
            <Self as ::serde::Deserialize>::deserialize(d)
        }
    }
    #[cfg(feature = "json")]
    #[doc(hidden)]
    pub const __LAYER_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
        type_url: "type.googleapis.com/vector_tile.Tile.Layer",
        to_json: ::buffa::type_registry::any_to_json::<Layer>,
        from_json: ::buffa::type_registry::any_from_json::<Layer>,
        is_wkt: false,
    };
    #[cfg(feature = "reader")]
    #[doc(inline)]
    pub use super::__buffa::view::tile::ValueView;
    #[cfg(feature = "reader")]
    #[doc(inline)]
    pub use super::__buffa::view::tile::ValueOwnedView;
    #[cfg(feature = "reader")]
    #[doc(inline)]
    pub use super::__buffa::view::tile::FeatureView;
    #[cfg(feature = "reader")]
    #[doc(inline)]
    pub use super::__buffa::view::tile::FeatureOwnedView;
    #[cfg(feature = "reader")]
    #[doc(inline)]
    pub use super::__buffa::view::tile::LayerView;
    #[cfg(feature = "reader")]
    #[doc(inline)]
    pub use super::__buffa::view::tile::LayerOwnedView;
}