@@ -10,12 +10,13 @@ extern crate flatbuffers;
10
10
use self :: flatbuffers:: { EndianScalar , Follow } ;
11
11
12
12
#[ deprecated( since = "2.0.0" , note = "Use associated constants instead. This will no longer be generated in 2021." ) ]
13
- pub const ENUM_MIN_ENDPOINT : i8 = 1 ;
13
+ pub const ENUM_MIN_ENDPOINT : i8 = 0 ;
14
14
#[ deprecated( since = "2.0.0" , note = "Use associated constants instead. This will no longer be generated in 2021." ) ]
15
15
pub const ENUM_MAX_ENDPOINT : i8 = 2 ;
16
16
#[ deprecated( since = "2.0.0" , note = "Use associated constants instead. This will no longer be generated in 2021." ) ]
17
17
#[ allow( non_camel_case_types) ]
18
- pub const ENUM_VALUES_ENDPOINT : [ Endpoint ; 2 ] = [
18
+ pub const ENUM_VALUES_ENDPOINT : [ Endpoint ; 3 ] = [
19
+ Endpoint :: Unknown ,
19
20
Endpoint :: Begin ,
20
21
Endpoint :: End ,
21
22
] ;
@@ -25,18 +26,21 @@ pub const ENUM_VALUES_ENDPOINT: [Endpoint; 2] = [
25
26
pub struct Endpoint ( pub i8 ) ;
26
27
#[ allow( non_upper_case_globals) ]
27
28
impl Endpoint {
29
+ pub const Unknown : Self = Self ( 0 ) ;
28
30
pub const Begin : Self = Self ( 1 ) ;
29
31
pub const End : Self = Self ( 2 ) ;
30
32
31
- pub const ENUM_MIN : i8 = 1 ;
33
+ pub const ENUM_MIN : i8 = 0 ;
32
34
pub const ENUM_MAX : i8 = 2 ;
33
35
pub const ENUM_VALUES : & ' static [ Self ] = & [
36
+ Self :: Unknown ,
34
37
Self :: Begin ,
35
38
Self :: End ,
36
39
] ;
37
40
/// Returns the variant's name or "" if unknown.
38
41
pub fn variant_name ( self ) -> Option < & ' static str > {
39
42
match self {
43
+ Self :: Unknown => Some ( "Unknown" ) ,
40
44
Self :: Begin => Some ( "Begin" ) ,
41
45
Self :: End => Some ( "End" ) ,
42
46
_ => None ,
@@ -1497,7 +1501,7 @@ impl<'a> Connection<'a> {
1497
1501
let mut builder = ConnectionBuilder :: new ( _fbb) ;
1498
1502
builder. add_segment_index ( args. segment_index ) ;
1499
1503
if let Some ( x) = args. properties { builder. add_properties ( x) ; }
1500
- if let Some ( x ) = args . endpoint { builder. add_endpoint ( x ) ; }
1504
+ builder. add_endpoint ( args . endpoint ) ;
1501
1505
builder. finish ( )
1502
1506
}
1503
1507
@@ -1518,11 +1522,11 @@ impl<'a> Connection<'a> {
1518
1522
}
1519
1523
/// A segment is oriented. The endpoint indicates what end of the segment is connected to the node
1520
1524
#[ inline]
1521
- pub fn endpoint ( & self ) -> Option < Endpoint > {
1525
+ pub fn endpoint ( & self ) -> Endpoint {
1522
1526
// Safety:
1523
1527
// Created from valid Table for this object
1524
1528
// which contains a valid value in this slot
1525
- unsafe { self . _tab . get :: < Endpoint > ( Connection :: VT_ENDPOINT , None ) }
1529
+ unsafe { self . _tab . get :: < Endpoint > ( Connection :: VT_ENDPOINT , Some ( Endpoint :: Unknown ) ) . unwrap ( ) }
1526
1530
}
1527
1531
}
1528
1532
@@ -1543,15 +1547,15 @@ impl flatbuffers::Verifiable for Connection<'_> {
1543
1547
pub struct ConnectionArgs < ' a > {
1544
1548
pub properties : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , flatbuffers:: ForwardsUOffset < Property < ' a > > > > > ,
1545
1549
pub segment_index : u64 ,
1546
- pub endpoint : Option < Endpoint > ,
1550
+ pub endpoint : Endpoint ,
1547
1551
}
1548
1552
impl < ' a > Default for ConnectionArgs < ' a > {
1549
1553
#[ inline]
1550
1554
fn default ( ) -> Self {
1551
1555
ConnectionArgs {
1552
1556
properties : None ,
1553
1557
segment_index : 0 ,
1554
- endpoint : None ,
1558
+ endpoint : Endpoint :: Unknown ,
1555
1559
}
1556
1560
}
1557
1561
}
@@ -1571,7 +1575,7 @@ impl<'a: 'b, 'b> ConnectionBuilder<'a, 'b> {
1571
1575
}
1572
1576
#[ inline]
1573
1577
pub fn add_endpoint ( & mut self , endpoint : Endpoint ) {
1574
- self . fbb_ . push_slot_always :: < Endpoint > ( Connection :: VT_ENDPOINT , endpoint) ;
1578
+ self . fbb_ . push_slot :: < Endpoint > ( Connection :: VT_ENDPOINT , endpoint, Endpoint :: Unknown ) ;
1575
1579
}
1576
1580
#[ inline]
1577
1581
pub fn new ( _fbb : & ' b mut flatbuffers:: FlatBufferBuilder < ' a > ) -> ConnectionBuilder < ' a , ' b > {
@@ -2134,7 +2138,7 @@ impl<'a> GeometryView<'a> {
2134
2138
if let Some ( x) = args. networks { builder. add_networks ( x) ; }
2135
2139
if let Some ( x) = args. anchors { builder. add_anchors ( x) ; }
2136
2140
if let Some ( x) = args. properties { builder. add_properties ( x) ; }
2137
- if let Some ( x ) = args . geometry_type { builder. add_geometry_type ( x ) ; }
2141
+ builder. add_geometry_type ( args . geometry_type ) ;
2138
2142
builder. finish ( )
2139
2143
}
2140
2144
@@ -2147,11 +2151,11 @@ impl<'a> GeometryView<'a> {
2147
2151
unsafe { self . _tab . get :: < flatbuffers:: ForwardsUOffset < flatbuffers:: Vector < ' a , flatbuffers:: ForwardsUOffset < Property > > > > ( GeometryView :: VT_PROPERTIES , None ) }
2148
2152
}
2149
2153
#[ inline]
2150
- pub fn geometry_type ( & self ) -> Option < GeometryType > {
2154
+ pub fn geometry_type ( & self ) -> GeometryType {
2151
2155
// Safety:
2152
2156
// Created from valid Table for this object
2153
2157
// which contains a valid value in this slot
2154
- unsafe { self . _tab . get :: < GeometryType > ( GeometryView :: VT_GEOMETRY_TYPE , None ) }
2158
+ unsafe { self . _tab . get :: < GeometryType > ( GeometryView :: VT_GEOMETRY_TYPE , Some ( GeometryType :: Geographic ) ) . unwrap ( ) }
2155
2159
}
2156
2160
#[ inline]
2157
2161
pub fn anchors ( & self ) -> flatbuffers:: Vector < ' a , flatbuffers:: ForwardsUOffset < AnchorGeometry < ' a > > > {
@@ -2187,7 +2191,7 @@ impl flatbuffers::Verifiable for GeometryView<'_> {
2187
2191
}
2188
2192
pub struct GeometryViewArgs < ' a > {
2189
2193
pub properties : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , flatbuffers:: ForwardsUOffset < Property < ' a > > > > > ,
2190
- pub geometry_type : Option < GeometryType > ,
2194
+ pub geometry_type : GeometryType ,
2191
2195
pub anchors : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , flatbuffers:: ForwardsUOffset < AnchorGeometry < ' a > > > > > ,
2192
2196
pub networks : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , flatbuffers:: ForwardsUOffset < NetworkGeometry < ' a > > > > > ,
2193
2197
}
@@ -2196,7 +2200,7 @@ impl<'a> Default for GeometryViewArgs<'a> {
2196
2200
fn default ( ) -> Self {
2197
2201
GeometryViewArgs {
2198
2202
properties : None ,
2199
- geometry_type : None ,
2203
+ geometry_type : GeometryType :: Geographic ,
2200
2204
anchors : None , // required field
2201
2205
networks : None , // required field
2202
2206
}
@@ -2214,7 +2218,7 @@ impl<'a: 'b, 'b> GeometryViewBuilder<'a, 'b> {
2214
2218
}
2215
2219
#[ inline]
2216
2220
pub fn add_geometry_type ( & mut self , geometry_type : GeometryType ) {
2217
- self . fbb_ . push_slot_always :: < GeometryType > ( GeometryView :: VT_GEOMETRY_TYPE , geometry_type) ;
2221
+ self . fbb_ . push_slot :: < GeometryType > ( GeometryView :: VT_GEOMETRY_TYPE , geometry_type, GeometryType :: Geographic ) ;
2218
2222
}
2219
2223
#[ inline]
2220
2224
pub fn add_anchors ( & mut self , anchors : flatbuffers:: WIPOffset < flatbuffers:: Vector < ' b , flatbuffers:: ForwardsUOffset < AnchorGeometry < ' b > > > > ) {
0 commit comments