Skip to main content

fcb_core/fb/
feature_generated.rs

1// automatically generated by the FlatBuffers compiler, do not modify
2
3// @generated
4
5use crate::extension_generated::*;
6use crate::geometry_generated::*;
7use crate::header_generated::*;
8use core::cmp::Ordering;
9use core::mem;
10
11extern crate flatbuffers;
12use self::flatbuffers::{EndianScalar, Follow};
13
14#[deprecated(
15    since = "2.0.0",
16    note = "Use associated constants instead. This will no longer be generated in 2021."
17)]
18pub const ENUM_MIN_CITY_OBJECT_TYPE: u8 = 0;
19#[deprecated(
20    since = "2.0.0",
21    note = "Use associated constants instead. This will no longer be generated in 2021."
22)]
23pub const ENUM_MAX_CITY_OBJECT_TYPE: u8 = 33;
24#[deprecated(
25    since = "2.0.0",
26    note = "Use associated constants instead. This will no longer be generated in 2021."
27)]
28#[allow(non_camel_case_types)]
29pub const ENUM_VALUES_CITY_OBJECT_TYPE: [CityObjectType; 34] = [
30    CityObjectType::Bridge,
31    CityObjectType::BridgePart,
32    CityObjectType::BridgeInstallation,
33    CityObjectType::BridgeConstructiveElement,
34    CityObjectType::BridgeRoom,
35    CityObjectType::BridgeFurniture,
36    CityObjectType::Building,
37    CityObjectType::BuildingPart,
38    CityObjectType::BuildingInstallation,
39    CityObjectType::BuildingConstructiveElement,
40    CityObjectType::BuildingFurniture,
41    CityObjectType::BuildingStorey,
42    CityObjectType::BuildingRoom,
43    CityObjectType::BuildingUnit,
44    CityObjectType::CityFurniture,
45    CityObjectType::CityObjectGroup,
46    CityObjectType::GenericCityObject,
47    CityObjectType::LandUse,
48    CityObjectType::OtherConstruction,
49    CityObjectType::PlantCover,
50    CityObjectType::SolitaryVegetationObject,
51    CityObjectType::TINRelief,
52    CityObjectType::Road,
53    CityObjectType::Railway,
54    CityObjectType::Waterway,
55    CityObjectType::TransportSquare,
56    CityObjectType::Tunnel,
57    CityObjectType::TunnelPart,
58    CityObjectType::TunnelInstallation,
59    CityObjectType::TunnelConstructiveElement,
60    CityObjectType::TunnelHollowSpace,
61    CityObjectType::TunnelFurniture,
62    CityObjectType::WaterBody,
63    CityObjectType::ExtensionObject,
64];
65
66#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
67#[repr(transparent)]
68pub struct CityObjectType(pub u8);
69#[allow(non_upper_case_globals)]
70impl CityObjectType {
71    pub const Bridge: Self = Self(0);
72    pub const BridgePart: Self = Self(1);
73    pub const BridgeInstallation: Self = Self(2);
74    pub const BridgeConstructiveElement: Self = Self(3);
75    pub const BridgeRoom: Self = Self(4);
76    pub const BridgeFurniture: Self = Self(5);
77    pub const Building: Self = Self(6);
78    pub const BuildingPart: Self = Self(7);
79    pub const BuildingInstallation: Self = Self(8);
80    pub const BuildingConstructiveElement: Self = Self(9);
81    pub const BuildingFurniture: Self = Self(10);
82    pub const BuildingStorey: Self = Self(11);
83    pub const BuildingRoom: Self = Self(12);
84    pub const BuildingUnit: Self = Self(13);
85    pub const CityFurniture: Self = Self(14);
86    pub const CityObjectGroup: Self = Self(15);
87    pub const GenericCityObject: Self = Self(16);
88    pub const LandUse: Self = Self(17);
89    pub const OtherConstruction: Self = Self(18);
90    pub const PlantCover: Self = Self(19);
91    pub const SolitaryVegetationObject: Self = Self(20);
92    pub const TINRelief: Self = Self(21);
93    pub const Road: Self = Self(22);
94    pub const Railway: Self = Self(23);
95    pub const Waterway: Self = Self(24);
96    pub const TransportSquare: Self = Self(25);
97    pub const Tunnel: Self = Self(26);
98    pub const TunnelPart: Self = Self(27);
99    pub const TunnelInstallation: Self = Self(28);
100    pub const TunnelConstructiveElement: Self = Self(29);
101    pub const TunnelHollowSpace: Self = Self(30);
102    pub const TunnelFurniture: Self = Self(31);
103    pub const WaterBody: Self = Self(32);
104    pub const ExtensionObject: Self = Self(33);
105
106    pub const ENUM_MIN: u8 = 0;
107    pub const ENUM_MAX: u8 = 33;
108    pub const ENUM_VALUES: &'static [Self] = &[
109        Self::Bridge,
110        Self::BridgePart,
111        Self::BridgeInstallation,
112        Self::BridgeConstructiveElement,
113        Self::BridgeRoom,
114        Self::BridgeFurniture,
115        Self::Building,
116        Self::BuildingPart,
117        Self::BuildingInstallation,
118        Self::BuildingConstructiveElement,
119        Self::BuildingFurniture,
120        Self::BuildingStorey,
121        Self::BuildingRoom,
122        Self::BuildingUnit,
123        Self::CityFurniture,
124        Self::CityObjectGroup,
125        Self::GenericCityObject,
126        Self::LandUse,
127        Self::OtherConstruction,
128        Self::PlantCover,
129        Self::SolitaryVegetationObject,
130        Self::TINRelief,
131        Self::Road,
132        Self::Railway,
133        Self::Waterway,
134        Self::TransportSquare,
135        Self::Tunnel,
136        Self::TunnelPart,
137        Self::TunnelInstallation,
138        Self::TunnelConstructiveElement,
139        Self::TunnelHollowSpace,
140        Self::TunnelFurniture,
141        Self::WaterBody,
142        Self::ExtensionObject,
143    ];
144    /// Returns the variant's name or "" if unknown.
145    pub fn variant_name(self) -> Option<&'static str> {
146        match self {
147            Self::Bridge => Some("Bridge"),
148            Self::BridgePart => Some("BridgePart"),
149            Self::BridgeInstallation => Some("BridgeInstallation"),
150            Self::BridgeConstructiveElement => Some("BridgeConstructiveElement"),
151            Self::BridgeRoom => Some("BridgeRoom"),
152            Self::BridgeFurniture => Some("BridgeFurniture"),
153            Self::Building => Some("Building"),
154            Self::BuildingPart => Some("BuildingPart"),
155            Self::BuildingInstallation => Some("BuildingInstallation"),
156            Self::BuildingConstructiveElement => Some("BuildingConstructiveElement"),
157            Self::BuildingFurniture => Some("BuildingFurniture"),
158            Self::BuildingStorey => Some("BuildingStorey"),
159            Self::BuildingRoom => Some("BuildingRoom"),
160            Self::BuildingUnit => Some("BuildingUnit"),
161            Self::CityFurniture => Some("CityFurniture"),
162            Self::CityObjectGroup => Some("CityObjectGroup"),
163            Self::GenericCityObject => Some("GenericCityObject"),
164            Self::LandUse => Some("LandUse"),
165            Self::OtherConstruction => Some("OtherConstruction"),
166            Self::PlantCover => Some("PlantCover"),
167            Self::SolitaryVegetationObject => Some("SolitaryVegetationObject"),
168            Self::TINRelief => Some("TINRelief"),
169            Self::Road => Some("Road"),
170            Self::Railway => Some("Railway"),
171            Self::Waterway => Some("Waterway"),
172            Self::TransportSquare => Some("TransportSquare"),
173            Self::Tunnel => Some("Tunnel"),
174            Self::TunnelPart => Some("TunnelPart"),
175            Self::TunnelInstallation => Some("TunnelInstallation"),
176            Self::TunnelConstructiveElement => Some("TunnelConstructiveElement"),
177            Self::TunnelHollowSpace => Some("TunnelHollowSpace"),
178            Self::TunnelFurniture => Some("TunnelFurniture"),
179            Self::WaterBody => Some("WaterBody"),
180            Self::ExtensionObject => Some("ExtensionObject"),
181            _ => None,
182        }
183    }
184}
185impl core::fmt::Debug for CityObjectType {
186    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187        if let Some(name) = self.variant_name() {
188            f.write_str(name)
189        } else {
190            f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
191        }
192    }
193}
194impl<'a> flatbuffers::Follow<'a> for CityObjectType {
195    type Inner = Self;
196    #[inline]
197    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
198        let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
199        Self(b)
200    }
201}
202
203impl flatbuffers::Push for CityObjectType {
204    type Output = CityObjectType;
205    #[inline]
206    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
207        unsafe {
208            flatbuffers::emplace_scalar::<u8>(dst, self.0);
209        }
210    }
211}
212
213impl flatbuffers::EndianScalar for CityObjectType {
214    type Scalar = u8;
215    #[inline]
216    fn to_little_endian(self) -> u8 {
217        self.0.to_le()
218    }
219    #[inline]
220    #[allow(clippy::wrong_self_convention)]
221    fn from_little_endian(v: u8) -> Self {
222        let b = u8::from_le(v);
223        Self(b)
224    }
225}
226
227impl<'a> flatbuffers::Verifiable for CityObjectType {
228    #[inline]
229    fn run_verifier(
230        v: &mut flatbuffers::Verifier,
231        pos: usize,
232    ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
233        use self::flatbuffers::Verifiable;
234        u8::run_verifier(v, pos)
235    }
236}
237
238impl flatbuffers::SimpleToVerifyInSlice for CityObjectType {}
239// struct Vertex, aligned to 4
240#[repr(transparent)]
241#[derive(Clone, Copy, PartialEq, Default)]
242pub struct Vertex(pub [u8; 12]);
243impl core::fmt::Debug for Vertex {
244    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
245        f.debug_struct("Vertex")
246            .field("x", &self.x())
247            .field("y", &self.y())
248            .field("z", &self.z())
249            .finish()
250    }
251}
252
253impl flatbuffers::SimpleToVerifyInSlice for Vertex {}
254impl<'a> flatbuffers::Follow<'a> for Vertex {
255    type Inner = &'a Vertex;
256    #[inline]
257    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
258        unsafe { <&'a Vertex>::follow(buf, loc) }
259    }
260}
261impl<'a> flatbuffers::Follow<'a> for &'a Vertex {
262    type Inner = &'a Vertex;
263    #[inline]
264    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
265        unsafe { flatbuffers::follow_cast_ref::<Vertex>(buf, loc) }
266    }
267}
268impl<'b> flatbuffers::Push for Vertex {
269    type Output = Vertex;
270    #[inline]
271    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
272        let src = unsafe {
273            ::core::slice::from_raw_parts(
274                self as *const Vertex as *const u8,
275                <Self as flatbuffers::Push>::size(),
276            )
277        };
278        dst.copy_from_slice(src);
279    }
280    #[inline]
281    fn alignment() -> flatbuffers::PushAlignment {
282        flatbuffers::PushAlignment::new(4)
283    }
284}
285
286impl<'a> flatbuffers::Verifiable for Vertex {
287    #[inline]
288    fn run_verifier(
289        v: &mut flatbuffers::Verifier,
290        pos: usize,
291    ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
292        use self::flatbuffers::Verifiable;
293        v.in_buffer::<Self>(pos)
294    }
295}
296
297impl<'a> Vertex {
298    #[allow(clippy::too_many_arguments)]
299    pub fn new(x: i32, y: i32, z: i32) -> Self {
300        let mut s = Self([0; 12]);
301        s.set_x(x);
302        s.set_y(y);
303        s.set_z(z);
304        s
305    }
306
307    pub fn x(&self) -> i32 {
308        let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
309        // Safety:
310        // Created from a valid Table for this object
311        // Which contains a valid value in this slot
312        EndianScalar::from_little_endian(unsafe {
313            core::ptr::copy_nonoverlapping(
314                self.0[0..].as_ptr(),
315                mem.as_mut_ptr() as *mut u8,
316                core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
317            );
318            mem.assume_init()
319        })
320    }
321
322    pub fn set_x(&mut self, x: i32) {
323        let x_le = x.to_little_endian();
324        // Safety:
325        // Created from a valid Table for this object
326        // Which contains a valid value in this slot
327        unsafe {
328            core::ptr::copy_nonoverlapping(
329                &x_le as *const _ as *const u8,
330                self.0[0..].as_mut_ptr(),
331                core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
332            );
333        }
334    }
335
336    pub fn y(&self) -> i32 {
337        let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
338        // Safety:
339        // Created from a valid Table for this object
340        // Which contains a valid value in this slot
341        EndianScalar::from_little_endian(unsafe {
342            core::ptr::copy_nonoverlapping(
343                self.0[4..].as_ptr(),
344                mem.as_mut_ptr() as *mut u8,
345                core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
346            );
347            mem.assume_init()
348        })
349    }
350
351    pub fn set_y(&mut self, x: i32) {
352        let x_le = x.to_little_endian();
353        // Safety:
354        // Created from a valid Table for this object
355        // Which contains a valid value in this slot
356        unsafe {
357            core::ptr::copy_nonoverlapping(
358                &x_le as *const _ as *const u8,
359                self.0[4..].as_mut_ptr(),
360                core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
361            );
362        }
363    }
364
365    pub fn z(&self) -> i32 {
366        let mut mem = core::mem::MaybeUninit::<<i32 as EndianScalar>::Scalar>::uninit();
367        // Safety:
368        // Created from a valid Table for this object
369        // Which contains a valid value in this slot
370        EndianScalar::from_little_endian(unsafe {
371            core::ptr::copy_nonoverlapping(
372                self.0[8..].as_ptr(),
373                mem.as_mut_ptr() as *mut u8,
374                core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
375            );
376            mem.assume_init()
377        })
378    }
379
380    pub fn set_z(&mut self, x: i32) {
381        let x_le = x.to_little_endian();
382        // Safety:
383        // Created from a valid Table for this object
384        // Which contains a valid value in this slot
385        unsafe {
386            core::ptr::copy_nonoverlapping(
387                &x_le as *const _ as *const u8,
388                self.0[8..].as_mut_ptr(),
389                core::mem::size_of::<<i32 as EndianScalar>::Scalar>(),
390            );
391        }
392    }
393}
394
395pub enum CityFeatureOffset {}
396#[derive(Copy, Clone, PartialEq)]
397
398pub struct CityFeature<'a> {
399    pub _tab: flatbuffers::Table<'a>,
400}
401
402impl<'a> flatbuffers::Follow<'a> for CityFeature<'a> {
403    type Inner = CityFeature<'a>;
404    #[inline]
405    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
406        Self {
407            _tab: unsafe { flatbuffers::Table::new(buf, loc) },
408        }
409    }
410}
411
412impl<'a> CityFeature<'a> {
413    pub const VT_ID: flatbuffers::VOffsetT = 4;
414    pub const VT_OBJECTS: flatbuffers::VOffsetT = 6;
415    pub const VT_VERTICES: flatbuffers::VOffsetT = 8;
416    pub const VT_APPEARANCE: flatbuffers::VOffsetT = 10;
417
418    #[inline]
419    pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
420        CityFeature { _tab: table }
421    }
422    #[allow(unused_mut)]
423    pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
424        _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
425        args: &'args CityFeatureArgs<'args>,
426    ) -> flatbuffers::WIPOffset<CityFeature<'bldr>> {
427        let mut builder = CityFeatureBuilder::new(_fbb);
428        if let Some(x) = args.appearance {
429            builder.add_appearance(x);
430        }
431        if let Some(x) = args.vertices {
432            builder.add_vertices(x);
433        }
434        if let Some(x) = args.objects {
435            builder.add_objects(x);
436        }
437        if let Some(x) = args.id {
438            builder.add_id(x);
439        }
440        builder.finish()
441    }
442
443    #[inline]
444    pub fn id(&self) -> &'a str {
445        // Safety:
446        // Created from valid Table for this object
447        // which contains a valid value in this slot
448        unsafe {
449            self._tab
450                .get::<flatbuffers::ForwardsUOffset<&str>>(CityFeature::VT_ID, None)
451                .unwrap()
452        }
453    }
454    #[inline]
455    pub fn key_compare_less_than(&self, o: &CityFeature) -> bool {
456        self.id() < o.id()
457    }
458
459    #[inline]
460    pub fn key_compare_with_value(&self, val: &str) -> ::core::cmp::Ordering {
461        let key = self.id();
462        key.cmp(val)
463    }
464    #[inline]
465    pub fn objects(
466        &self,
467    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<CityObject<'a>>>> {
468        // Safety:
469        // Created from valid Table for this object
470        // which contains a valid value in this slot
471        unsafe {
472            self._tab.get::<flatbuffers::ForwardsUOffset<
473                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<CityObject>>,
474            >>(CityFeature::VT_OBJECTS, None)
475        }
476    }
477    #[inline]
478    pub fn vertices(&self) -> Option<flatbuffers::Vector<'a, Vertex>> {
479        // Safety:
480        // Created from valid Table for this object
481        // which contains a valid value in this slot
482        unsafe {
483            self._tab
484                .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Vertex>>>(
485                    CityFeature::VT_VERTICES,
486                    None,
487                )
488        }
489    }
490    #[inline]
491    pub fn appearance(&self) -> Option<Appearance<'a>> {
492        // Safety:
493        // Created from valid Table for this object
494        // which contains a valid value in this slot
495        unsafe {
496            self._tab
497                .get::<flatbuffers::ForwardsUOffset<Appearance>>(CityFeature::VT_APPEARANCE, None)
498        }
499    }
500}
501
502impl flatbuffers::Verifiable for CityFeature<'_> {
503    #[inline]
504    fn run_verifier(
505        v: &mut flatbuffers::Verifier,
506        pos: usize,
507    ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
508        use self::flatbuffers::Verifiable;
509        v.visit_table(pos)?
510            .visit_field::<flatbuffers::ForwardsUOffset<&str>>("id", Self::VT_ID, true)?
511            .visit_field::<flatbuffers::ForwardsUOffset<
512                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<CityObject>>,
513            >>("objects", Self::VT_OBJECTS, false)?
514            .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Vertex>>>(
515                "vertices",
516                Self::VT_VERTICES,
517                false,
518            )?
519            .visit_field::<flatbuffers::ForwardsUOffset<Appearance>>(
520                "appearance",
521                Self::VT_APPEARANCE,
522                false,
523            )?
524            .finish();
525        Ok(())
526    }
527}
528pub struct CityFeatureArgs<'a> {
529    pub id: Option<flatbuffers::WIPOffset<&'a str>>,
530    pub objects: Option<
531        flatbuffers::WIPOffset<
532            flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<CityObject<'a>>>,
533        >,
534    >,
535    pub vertices: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Vertex>>>,
536    pub appearance: Option<flatbuffers::WIPOffset<Appearance<'a>>>,
537}
538impl<'a> Default for CityFeatureArgs<'a> {
539    #[inline]
540    fn default() -> Self {
541        CityFeatureArgs {
542            id: None, // required field
543            objects: None,
544            vertices: None,
545            appearance: None,
546        }
547    }
548}
549
550pub struct CityFeatureBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
551    fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
552    start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
553}
554impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CityFeatureBuilder<'a, 'b, A> {
555    #[inline]
556    pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) {
557        self.fbb_
558            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityFeature::VT_ID, id);
559    }
560    #[inline]
561    pub fn add_objects(
562        &mut self,
563        objects: flatbuffers::WIPOffset<
564            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<CityObject<'b>>>,
565        >,
566    ) {
567        self.fbb_
568            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityFeature::VT_OBJECTS, objects);
569    }
570    #[inline]
571    pub fn add_vertices(
572        &mut self,
573        vertices: flatbuffers::WIPOffset<flatbuffers::Vector<'b, Vertex>>,
574    ) {
575        self.fbb_
576            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityFeature::VT_VERTICES, vertices);
577    }
578    #[inline]
579    pub fn add_appearance(&mut self, appearance: flatbuffers::WIPOffset<Appearance<'b>>) {
580        self.fbb_
581            .push_slot_always::<flatbuffers::WIPOffset<Appearance>>(
582                CityFeature::VT_APPEARANCE,
583                appearance,
584            );
585    }
586    #[inline]
587    pub fn new(
588        _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
589    ) -> CityFeatureBuilder<'a, 'b, A> {
590        let start = _fbb.start_table();
591        CityFeatureBuilder {
592            fbb_: _fbb,
593            start_: start,
594        }
595    }
596    #[inline]
597    pub fn finish(self) -> flatbuffers::WIPOffset<CityFeature<'a>> {
598        let o = self.fbb_.end_table(self.start_);
599        self.fbb_.required(o, CityFeature::VT_ID, "id");
600        flatbuffers::WIPOffset::new(o.value())
601    }
602}
603
604impl core::fmt::Debug for CityFeature<'_> {
605    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
606        let mut ds = f.debug_struct("CityFeature");
607        ds.field("id", &self.id());
608        ds.field("objects", &self.objects());
609        ds.field("vertices", &self.vertices());
610        ds.field("appearance", &self.appearance());
611        ds.finish()
612    }
613}
614pub enum CityObjectOffset {}
615#[derive(Copy, Clone, PartialEq)]
616
617pub struct CityObject<'a> {
618    pub _tab: flatbuffers::Table<'a>,
619}
620
621impl<'a> flatbuffers::Follow<'a> for CityObject<'a> {
622    type Inner = CityObject<'a>;
623    #[inline]
624    unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
625        Self {
626            _tab: unsafe { flatbuffers::Table::new(buf, loc) },
627        }
628    }
629}
630
631impl<'a> CityObject<'a> {
632    pub const VT_TYPE_: flatbuffers::VOffsetT = 4;
633    pub const VT_EXTENSION_TYPE: flatbuffers::VOffsetT = 6;
634    pub const VT_ID: flatbuffers::VOffsetT = 8;
635    pub const VT_GEOGRAPHICAL_EXTENT: flatbuffers::VOffsetT = 10;
636    pub const VT_GEOMETRY: flatbuffers::VOffsetT = 12;
637    pub const VT_GEOMETRY_INSTANCES: flatbuffers::VOffsetT = 14;
638    pub const VT_ATTRIBUTES: flatbuffers::VOffsetT = 16;
639    pub const VT_COLUMNS: flatbuffers::VOffsetT = 18;
640    pub const VT_CHILDREN: flatbuffers::VOffsetT = 20;
641    pub const VT_CHILDREN_ROLES: flatbuffers::VOffsetT = 22;
642    pub const VT_PARENTS: flatbuffers::VOffsetT = 24;
643
644    #[inline]
645    pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
646        CityObject { _tab: table }
647    }
648    #[allow(unused_mut)]
649    pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
650        _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
651        args: &'args CityObjectArgs<'args>,
652    ) -> flatbuffers::WIPOffset<CityObject<'bldr>> {
653        let mut builder = CityObjectBuilder::new(_fbb);
654        if let Some(x) = args.parents {
655            builder.add_parents(x);
656        }
657        if let Some(x) = args.children_roles {
658            builder.add_children_roles(x);
659        }
660        if let Some(x) = args.children {
661            builder.add_children(x);
662        }
663        if let Some(x) = args.columns {
664            builder.add_columns(x);
665        }
666        if let Some(x) = args.attributes {
667            builder.add_attributes(x);
668        }
669        if let Some(x) = args.geometry_instances {
670            builder.add_geometry_instances(x);
671        }
672        if let Some(x) = args.geometry {
673            builder.add_geometry(x);
674        }
675        if let Some(x) = args.geographical_extent {
676            builder.add_geographical_extent(x);
677        }
678        if let Some(x) = args.id {
679            builder.add_id(x);
680        }
681        if let Some(x) = args.extension_type {
682            builder.add_extension_type(x);
683        }
684        builder.add_type_(args.type_);
685        builder.finish()
686    }
687
688    #[inline]
689    pub fn type_(&self) -> CityObjectType {
690        // Safety:
691        // Created from valid Table for this object
692        // which contains a valid value in this slot
693        unsafe {
694            self._tab
695                .get::<CityObjectType>(CityObject::VT_TYPE_, Some(CityObjectType::Bridge))
696                .unwrap()
697        }
698    }
699    #[inline]
700    pub fn extension_type(&self) -> Option<&'a str> {
701        // Safety:
702        // Created from valid Table for this object
703        // which contains a valid value in this slot
704        unsafe {
705            self._tab
706                .get::<flatbuffers::ForwardsUOffset<&str>>(CityObject::VT_EXTENSION_TYPE, None)
707        }
708    }
709    #[inline]
710    pub fn id(&self) -> &'a str {
711        // Safety:
712        // Created from valid Table for this object
713        // which contains a valid value in this slot
714        unsafe {
715            self._tab
716                .get::<flatbuffers::ForwardsUOffset<&str>>(CityObject::VT_ID, None)
717                .unwrap()
718        }
719    }
720    #[inline]
721    pub fn key_compare_less_than(&self, o: &CityObject) -> bool {
722        self.id() < o.id()
723    }
724
725    #[inline]
726    pub fn key_compare_with_value(&self, val: &str) -> ::core::cmp::Ordering {
727        let key = self.id();
728        key.cmp(val)
729    }
730    #[inline]
731    pub fn geographical_extent(&self) -> Option<&'a GeographicalExtent> {
732        // Safety:
733        // Created from valid Table for this object
734        // which contains a valid value in this slot
735        unsafe {
736            self._tab
737                .get::<GeographicalExtent>(CityObject::VT_GEOGRAPHICAL_EXTENT, None)
738        }
739    }
740    #[inline]
741    pub fn geometry(
742        &self,
743    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry<'a>>>> {
744        // Safety:
745        // Created from valid Table for this object
746        // which contains a valid value in this slot
747        unsafe {
748            self._tab.get::<flatbuffers::ForwardsUOffset<
749                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry>>,
750            >>(CityObject::VT_GEOMETRY, None)
751        }
752    }
753    #[inline]
754    pub fn geometry_instances(
755        &self,
756    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<GeometryInstance<'a>>>> {
757        // Safety:
758        // Created from valid Table for this object
759        // which contains a valid value in this slot
760        unsafe {
761            self._tab.get::<flatbuffers::ForwardsUOffset<
762                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<GeometryInstance>>,
763            >>(CityObject::VT_GEOMETRY_INSTANCES, None)
764        }
765    }
766    #[inline]
767    pub fn attributes(&self) -> Option<flatbuffers::Vector<'a, u8>> {
768        // Safety:
769        // Created from valid Table for this object
770        // which contains a valid value in this slot
771        unsafe {
772            self._tab
773                .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(
774                    CityObject::VT_ATTRIBUTES,
775                    None,
776                )
777        }
778    }
779    #[inline]
780    pub fn columns(
781        &self,
782    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>> {
783        // Safety:
784        // Created from valid Table for this object
785        // which contains a valid value in this slot
786        unsafe {
787            self._tab.get::<flatbuffers::ForwardsUOffset<
788                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column>>,
789            >>(CityObject::VT_COLUMNS, None)
790        }
791    }
792    #[inline]
793    pub fn children(
794        &self,
795    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
796        // Safety:
797        // Created from valid Table for this object
798        // which contains a valid value in this slot
799        unsafe {
800            self._tab.get::<flatbuffers::ForwardsUOffset<
801                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>,
802            >>(CityObject::VT_CHILDREN, None)
803        }
804    }
805    #[inline]
806    pub fn children_roles(
807        &self,
808    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
809        // Safety:
810        // Created from valid Table for this object
811        // which contains a valid value in this slot
812        unsafe {
813            self._tab.get::<flatbuffers::ForwardsUOffset<
814                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>,
815            >>(CityObject::VT_CHILDREN_ROLES, None)
816        }
817    }
818    #[inline]
819    pub fn parents(
820        &self,
821    ) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
822        // Safety:
823        // Created from valid Table for this object
824        // which contains a valid value in this slot
825        unsafe {
826            self._tab.get::<flatbuffers::ForwardsUOffset<
827                flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>,
828            >>(CityObject::VT_PARENTS, None)
829        }
830    }
831}
832
833impl flatbuffers::Verifiable for CityObject<'_> {
834    #[inline]
835    fn run_verifier(
836        v: &mut flatbuffers::Verifier,
837        pos: usize,
838    ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
839        use self::flatbuffers::Verifiable;
840        v.visit_table(pos)?
841            .visit_field::<CityObjectType>("type_", Self::VT_TYPE_, false)?
842            .visit_field::<flatbuffers::ForwardsUOffset<&str>>(
843                "extension_type",
844                Self::VT_EXTENSION_TYPE,
845                false,
846            )?
847            .visit_field::<flatbuffers::ForwardsUOffset<&str>>("id", Self::VT_ID, true)?
848            .visit_field::<GeographicalExtent>(
849                "geographical_extent",
850                Self::VT_GEOGRAPHICAL_EXTENT,
851                false,
852            )?
853            .visit_field::<flatbuffers::ForwardsUOffset<
854                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Geometry>>,
855            >>("geometry", Self::VT_GEOMETRY, false)?
856            .visit_field::<flatbuffers::ForwardsUOffset<
857                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<GeometryInstance>>,
858            >>("geometry_instances", Self::VT_GEOMETRY_INSTANCES, false)?
859            .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>(
860                "attributes",
861                Self::VT_ATTRIBUTES,
862                false,
863            )?
864            .visit_field::<flatbuffers::ForwardsUOffset<
865                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Column>>,
866            >>("columns", Self::VT_COLUMNS, false)?
867            .visit_field::<flatbuffers::ForwardsUOffset<
868                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>,
869            >>("children", Self::VT_CHILDREN, false)?
870            .visit_field::<flatbuffers::ForwardsUOffset<
871                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>,
872            >>("children_roles", Self::VT_CHILDREN_ROLES, false)?
873            .visit_field::<flatbuffers::ForwardsUOffset<
874                flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>,
875            >>("parents", Self::VT_PARENTS, false)?
876            .finish();
877        Ok(())
878    }
879}
880pub struct CityObjectArgs<'a> {
881    pub type_: CityObjectType,
882    pub extension_type: Option<flatbuffers::WIPOffset<&'a str>>,
883    pub id: Option<flatbuffers::WIPOffset<&'a str>>,
884    pub geographical_extent: Option<&'a GeographicalExtent>,
885    pub geometry: Option<
886        flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Geometry<'a>>>>,
887    >,
888    pub geometry_instances: Option<
889        flatbuffers::WIPOffset<
890            flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<GeometryInstance<'a>>>,
891        >,
892    >,
893    pub attributes: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
894    pub columns: Option<
895        flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>>,
896    >,
897    pub children: Option<
898        flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>,
899    >,
900    pub children_roles: Option<
901        flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>,
902    >,
903    pub parents: Option<
904        flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>,
905    >,
906}
907impl<'a> Default for CityObjectArgs<'a> {
908    #[inline]
909    fn default() -> Self {
910        CityObjectArgs {
911            type_: CityObjectType::Bridge,
912            extension_type: None,
913            id: None, // required field
914            geographical_extent: None,
915            geometry: None,
916            geometry_instances: None,
917            attributes: None,
918            columns: None,
919            children: None,
920            children_roles: None,
921            parents: None,
922        }
923    }
924}
925
926pub struct CityObjectBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
927    fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
928    start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
929}
930impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CityObjectBuilder<'a, 'b, A> {
931    #[inline]
932    pub fn add_type_(&mut self, type_: CityObjectType) {
933        self.fbb_
934            .push_slot::<CityObjectType>(CityObject::VT_TYPE_, type_, CityObjectType::Bridge);
935    }
936    #[inline]
937    pub fn add_extension_type(&mut self, extension_type: flatbuffers::WIPOffset<&'b str>) {
938        self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
939            CityObject::VT_EXTENSION_TYPE,
940            extension_type,
941        );
942    }
943    #[inline]
944    pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) {
945        self.fbb_
946            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityObject::VT_ID, id);
947    }
948    #[inline]
949    pub fn add_geographical_extent(&mut self, geographical_extent: &GeographicalExtent) {
950        self.fbb_.push_slot_always::<&GeographicalExtent>(
951            CityObject::VT_GEOGRAPHICAL_EXTENT,
952            geographical_extent,
953        );
954    }
955    #[inline]
956    pub fn add_geometry(
957        &mut self,
958        geometry: flatbuffers::WIPOffset<
959            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<Geometry<'b>>>,
960        >,
961    ) {
962        self.fbb_
963            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityObject::VT_GEOMETRY, geometry);
964    }
965    #[inline]
966    pub fn add_geometry_instances(
967        &mut self,
968        geometry_instances: flatbuffers::WIPOffset<
969            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<GeometryInstance<'b>>>,
970        >,
971    ) {
972        self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
973            CityObject::VT_GEOMETRY_INSTANCES,
974            geometry_instances,
975        );
976    }
977    #[inline]
978    pub fn add_attributes(
979        &mut self,
980        attributes: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u8>>,
981    ) {
982        self.fbb_
983            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityObject::VT_ATTRIBUTES, attributes);
984    }
985    #[inline]
986    pub fn add_columns(
987        &mut self,
988        columns: flatbuffers::WIPOffset<
989            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<Column<'b>>>,
990        >,
991    ) {
992        self.fbb_
993            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityObject::VT_COLUMNS, columns);
994    }
995    #[inline]
996    pub fn add_children(
997        &mut self,
998        children: flatbuffers::WIPOffset<
999            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<&'b str>>,
1000        >,
1001    ) {
1002        self.fbb_
1003            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityObject::VT_CHILDREN, children);
1004    }
1005    #[inline]
1006    pub fn add_children_roles(
1007        &mut self,
1008        children_roles: flatbuffers::WIPOffset<
1009            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<&'b str>>,
1010        >,
1011    ) {
1012        self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
1013            CityObject::VT_CHILDREN_ROLES,
1014            children_roles,
1015        );
1016    }
1017    #[inline]
1018    pub fn add_parents(
1019        &mut self,
1020        parents: flatbuffers::WIPOffset<
1021            flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<&'b str>>,
1022        >,
1023    ) {
1024        self.fbb_
1025            .push_slot_always::<flatbuffers::WIPOffset<_>>(CityObject::VT_PARENTS, parents);
1026    }
1027    #[inline]
1028    pub fn new(
1029        _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
1030    ) -> CityObjectBuilder<'a, 'b, A> {
1031        let start = _fbb.start_table();
1032        CityObjectBuilder {
1033            fbb_: _fbb,
1034            start_: start,
1035        }
1036    }
1037    #[inline]
1038    pub fn finish(self) -> flatbuffers::WIPOffset<CityObject<'a>> {
1039        let o = self.fbb_.end_table(self.start_);
1040        self.fbb_.required(o, CityObject::VT_ID, "id");
1041        flatbuffers::WIPOffset::new(o.value())
1042    }
1043}
1044
1045impl core::fmt::Debug for CityObject<'_> {
1046    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1047        let mut ds = f.debug_struct("CityObject");
1048        ds.field("type_", &self.type_());
1049        ds.field("extension_type", &self.extension_type());
1050        ds.field("id", &self.id());
1051        ds.field("geographical_extent", &self.geographical_extent());
1052        ds.field("geometry", &self.geometry());
1053        ds.field("geometry_instances", &self.geometry_instances());
1054        ds.field("attributes", &self.attributes());
1055        ds.field("columns", &self.columns());
1056        ds.field("children", &self.children());
1057        ds.field("children_roles", &self.children_roles());
1058        ds.field("parents", &self.parents());
1059        ds.finish()
1060    }
1061}
1062#[inline]
1063/// Verifies that a buffer of bytes contains a `CityFeature`
1064/// and returns it.
1065/// Note that verification is still experimental and may not
1066/// catch every error, or be maximally performant. For the
1067/// previous, unchecked, behavior use
1068/// `root_as_city_feature_unchecked`.
1069pub fn root_as_city_feature(buf: &[u8]) -> Result<CityFeature<'_>, flatbuffers::InvalidFlatbuffer> {
1070    flatbuffers::root::<CityFeature>(buf)
1071}
1072#[inline]
1073/// Verifies that a buffer of bytes contains a size prefixed
1074/// `CityFeature` and returns it.
1075/// Note that verification is still experimental and may not
1076/// catch every error, or be maximally performant. For the
1077/// previous, unchecked, behavior use
1078/// `size_prefixed_root_as_city_feature_unchecked`.
1079pub fn size_prefixed_root_as_city_feature(
1080    buf: &[u8],
1081) -> Result<CityFeature<'_>, flatbuffers::InvalidFlatbuffer> {
1082    flatbuffers::size_prefixed_root::<CityFeature>(buf)
1083}
1084#[inline]
1085/// Verifies, with the given options, that a buffer of bytes
1086/// contains a `CityFeature` and returns it.
1087/// Note that verification is still experimental and may not
1088/// catch every error, or be maximally performant. For the
1089/// previous, unchecked, behavior use
1090/// `root_as_city_feature_unchecked`.
1091pub fn root_as_city_feature_with_opts<'b, 'o>(
1092    opts: &'o flatbuffers::VerifierOptions,
1093    buf: &'b [u8],
1094) -> Result<CityFeature<'b>, flatbuffers::InvalidFlatbuffer> {
1095    flatbuffers::root_with_opts::<CityFeature<'b>>(opts, buf)
1096}
1097#[inline]
1098/// Verifies, with the given verifier options, that a buffer of
1099/// bytes contains a size prefixed `CityFeature` and returns
1100/// it. Note that verification is still experimental and may not
1101/// catch every error, or be maximally performant. For the
1102/// previous, unchecked, behavior use
1103/// `root_as_city_feature_unchecked`.
1104pub fn size_prefixed_root_as_city_feature_with_opts<'b, 'o>(
1105    opts: &'o flatbuffers::VerifierOptions,
1106    buf: &'b [u8],
1107) -> Result<CityFeature<'b>, flatbuffers::InvalidFlatbuffer> {
1108    flatbuffers::size_prefixed_root_with_opts::<CityFeature<'b>>(opts, buf)
1109}
1110#[inline]
1111/// Assumes, without verification, that a buffer of bytes contains a CityFeature and returns it.
1112/// # Safety
1113/// Callers must trust the given bytes do indeed contain a valid `CityFeature`.
1114pub unsafe fn root_as_city_feature_unchecked(buf: &[u8]) -> CityFeature<'_> {
1115    unsafe { flatbuffers::root_unchecked::<CityFeature>(buf) }
1116}
1117#[inline]
1118/// Assumes, without verification, that a buffer of bytes contains a size prefixed CityFeature and returns it.
1119/// # Safety
1120/// Callers must trust the given bytes do indeed contain a valid size prefixed `CityFeature`.
1121pub unsafe fn size_prefixed_root_as_city_feature_unchecked(buf: &[u8]) -> CityFeature<'_> {
1122    unsafe { flatbuffers::size_prefixed_root_unchecked::<CityFeature>(buf) }
1123}
1124#[inline]
1125pub fn finish_city_feature_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
1126    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
1127    root: flatbuffers::WIPOffset<CityFeature<'a>>,
1128) {
1129    fbb.finish(root, None);
1130}
1131
1132#[inline]
1133pub fn finish_size_prefixed_city_feature_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
1134    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
1135    root: flatbuffers::WIPOffset<CityFeature<'a>>,
1136) {
1137    fbb.finish_size_prefixed(root, None);
1138}