13 Revize

Autor SHA1 Zpráva Datum
  Johannes Hofmann 9655cbd601 Release 0.2.2 před 5 roky
  Johannes Hofmann ac05a602ba Regenerate *.rs files in `src/proto/` před 5 roky
  Johannes Hofmann 0b1a5c3f63 Update CI config to actually fail on error před 5 roky
  Johannes Hofmann 7bd6a91083 Release 0.2.1 před 5 roky
  Johannes Hofmann df3d8b2a21 README, lib.rs: Use ? operator in documentation před 5 roky
  Johannes Hofmann d3170b4c46 Fix deprecation warnings of protoc_rust před 5 roky
  Johannes Hofmann 5b150dc338 Regenerate *.rs files in `src/proto/` před 5 roky
  Johannes Hofmann c7b110a9e8 CI: Bump minimum supported Rust version to 1.44.1 před 5 roky
  Johannes Hofmann 6869e41d62 Release 0.2.0 před 5 roky
  Johannes Hofmann 055192e9c4 dense.rs: Fix minor typo před 5 roky
  Johannes Hofmann a990538123 Merge branch 'bugfix/dense_node_iterator' of https://github.com/nikmikov/osmpbf into nikmikov-bugfix/dense_node_iterator před 5 roky
  Johannes Hofmann 3dfd10b765 Regenerate *.rs files in `src/proto/` před 5 roky
  Nikolay Mikov ee82ea359b Fix DenseNodeIter when dense node info is empty před 5 roky
10 změnil soubory, kde provedl 296 přidání a 327 odebrání
  1. 1
    1
      .appveyor.yml
  2. 4
    5
      .travis.yml
  3. 2
    2
      Cargo.toml
  4. 28
    34
      README.md
  5. 5
    8
      build_proto.rs
  6. 121
    70
      src/dense.rs
  7. 9
    5
      src/lib.rs
  8. 14
    27
      src/proto/fileformat.rs
  9. 109
    172
      src/proto/osmformat.rs
  10. 3
    3
      tests/read.rs

+ 1
- 1
.appveyor.yml Zobrazit soubor

@@ -16,7 +16,7 @@ environment:
16 16
       target: x86_64-pc-windows-msvc
17 17
     - channel: stable
18 18
       target: i686-pc-windows-msvc
19
-    - channel: 1.36.0
19
+    - channel: 1.44.1
20 20
       target: x86_64-pc-windows-msvc
21 21
 
22 22
 install:

+ 4
- 5
.travis.yml Zobrazit soubor

@@ -4,11 +4,10 @@ rust:
4 4
   - stable
5 5
   - beta
6 6
   - nightly
7
-  - 1.36.0
7
+  - 1.44.1
8 8
 script:
9
-  - |
10
-      cargo test --verbose;
11
-      cargo test --verbose --no-default-features;
12
-      cargo doc --verbose;
9
+  - cargo test --verbose
10
+  - cargo test --verbose --no-default-features
11
+  - cargo doc --verbose
13 12
 env:
14 13
   - RUSTFLAGS="-D warnings"

+ 2
- 2
Cargo.toml Zobrazit soubor

@@ -1,6 +1,6 @@
1 1
 [package]
2 2
 name = "osmpbf"
3
-version = "0.1.17"
3
+version = "0.2.2"
4 4
 authors = ["Johannes Hofmann <mail@b-r-u.org>"]
5 5
 readme = "README.md"
6 6
 repository = "https://github.com/b-r-u/osmpbf"
@@ -21,7 +21,7 @@ default = ["system-libz"]
21 21
 system-libz = ["flate2"]
22 22
 
23 23
 [dependencies]
24
-protobuf = "=2.10.1"
24
+protobuf = "2.14"
25 25
 byteorder = "1.1"
26 26
 flate2 = { version = "1.0", optional = true }
27 27
 inflate = "0.4"

+ 28
- 34
README.md Zobrazit soubor

@@ -16,7 +16,7 @@ Add this to your `Cargo.toml`:
16 16
 
17 17
 ```toml
18 18
 [dependencies]
19
-osmpbf = "0.1"
19
+osmpbf = "0.2"
20 20
 ```
21 21
 
22 22
 and if you're using Rust 2015, add this line to the crate root:
@@ -28,48 +28,42 @@ extern crate osmpbf;
28 28
 Here's a simple example that counts all the ways in a file:
29 29
 
30 30
 ```rust
31
-extern crate osmpbf;
32
-
33
-use osmpbf::*;
31
+use osmpbf::{ElementReader, Element};
34 32
 
35
-fn main() {
36
-    let reader = ElementReader::from_path("tests/test.osm.pbf").unwrap();
37
-    let mut ways = 0_u64;
33
+let reader = ElementReader::from_path("tests/test.osm.pbf")?;
34
+let mut ways = 0_u64;
38 35
 
39
-    // Increment the counter by one for each way.
40
-    reader.for_each(|element| {
41
-        if let Element::Way(_) = element {
42
-            ways += 1;
43
-        }
44
-    }).unwrap();
36
+// Increment the counter by one for each way.
37
+reader.for_each(|element| {
38
+    if let Element::Way(_) = element {
39
+        ways += 1;
40
+    }
41
+})?;
45 42
 
46
-    println!("Number of ways: {}", ways);
47
-}
43
+println!("Number of ways: {}", ways);
48 44
 ```
49 45
 
50 46
 In this second example, we also count the ways but make use of all cores by
51 47
 decoding the file in parallel:
52 48
 
53 49
 ```rust
54
-use osmpbf::*;
55
-
56
-fn main() {
57
-    let reader = ElementReader::from_path("tests/test.osm.pbf").unwrap();
58
-
59
-    // Count the ways
60
-    let ways = reader.par_map_reduce(
61
-        |element| {
62
-            match element {
63
-                Element::Way(_) => 1,
64
-                _ => 0,
65
-            }
66
-        },
67
-        || 0_u64,      // Zero is the identity value for addition
68
-        |a, b| a + b   // Sum the partial results
69
-    ).unwrap();
70
-
71
-    println!("Number of ways: {}", ways);
72
-}
50
+use osmpbf::{ElementReader, Element};
51
+
52
+let reader = ElementReader::from_path("tests/test.osm.pbf")?;
53
+
54
+// Count the ways
55
+let ways = reader.par_map_reduce(
56
+    |element| {
57
+        match element {
58
+            Element::Way(_) => 1,
59
+            _ => 0,
60
+        }
61
+    },
62
+    || 0_u64,      // Zero is the identity value for addition
63
+    |a, b| a + b   // Sum the partial results
64
+)?;
65
+
66
+println!("Number of ways: {}", ways);
73 67
 ```
74 68
 
75 69
 ## The PBF format

+ 5
- 8
build_proto.rs Zobrazit soubor

@@ -14,12 +14,9 @@ fn main() {
14 14
         println!("cargo:rerun-if-changed={}", path);
15 15
     }
16 16
 
17
-    protoc_rust::run(protoc_rust::Args {
18
-        out_dir: "src/proto",
19
-        input: &proto_files,
20
-        customize: protoc_rust::Customize {
21
-            ..Default::default()
22
-        },
23
-        includes: &[],
24
-    }).expect("protoc");
17
+    protoc_rust::Codegen::new()
18
+        .out_dir("src/proto")
19
+        .inputs(&proto_files)
20
+        .run()
21
+        .expect("Running protoc failed.");
25 22
 }

+ 121
- 70
src/dense.rs Zobrazit soubor

@@ -14,23 +14,16 @@ pub struct DenseNode<'a> {
14 14
     /// The node id. It should be unique between nodes and might be negative to indicate
15 15
     /// that the element has not yet been uploaded to a server.
16 16
     pub id: i64,
17
-    /// The version of this element.
18
-    pub version: i32,
19
-    timestamp: i64,
20
-    /// The changeset id.
21
-    pub changeset: i64,
22
-    /// The user id.
23
-    pub uid: i32,
24
-    user_sid: i32,
25 17
     lat: i64,
26 18
     lon: i64,
27 19
     keys_vals_indices: &'a [i32],
20
+    info: Option<DenseNodeInfo<'a>>,
28 21
 }
29 22
 
30 23
 impl<'a> DenseNode<'a> {
31
-    /// Returns the user name.
32
-    pub fn user(&self) -> Result<&'a str> {
33
-        str_from_stringtable(self.block, self.user_sid as usize)
24
+    /// return optional metadata about the ndode
25
+    pub fn info(&'a self) -> Option<&'a DenseNodeInfo<'a>> {
26
+        self.info.as_ref()
34 27
     }
35 28
 
36 29
     /// Returns the latitude coordinate in degrees.
@@ -63,11 +56,6 @@ impl<'a> DenseNode<'a> {
63 56
         (self.nano_lon() / 100) as i32
64 57
     }
65 58
 
66
-    /// Returns the time stamp in milliseconds since the epoch.
67
-    pub fn milli_timestamp(&self) -> i64 {
68
-        self.timestamp * i64::from(self.block.get_date_granularity())
69
-    }
70
-
71 59
     /// Returns an iterator over the tags of this node (See [OSM wiki](http://wiki.openstreetmap.org/wiki/Tags)).
72 60
     pub fn tags(&self) -> DenseTagIter<'a> {
73 61
         DenseTagIter {
@@ -91,23 +79,15 @@ impl<'a> DenseNode<'a> {
91 79
 #[derive(Clone, Debug)]
92 80
 pub struct DenseNodeIter<'a> {
93 81
     block: &'a osmformat::PrimitiveBlock,
94
-    dids: std::slice::Iter<'a, i64>, // deltas
95
-    cid: i64,                        // current id
96
-    versions: std::slice::Iter<'a, i32>,
97
-    dtimestamps: std::slice::Iter<'a, i64>, // deltas
98
-    ctimestamp: i64,
99
-    dchangesets: std::slice::Iter<'a, i64>, // deltas
100
-    cchangeset: i64,
101
-    duids: std::slice::Iter<'a, i32>, // deltas
102
-    cuid: i32,
103
-    duser_sids: std::slice::Iter<'a, i32>, // deltas
104
-    cuser_sid: i32,
82
+    dids: std::slice::Iter<'a, i64>,  // deltas
83
+    cid: i64,                         // current id
105 84
     dlats: std::slice::Iter<'a, i64>, // deltas
106 85
     clat: i64,
107 86
     dlons: std::slice::Iter<'a, i64>, // deltas
108 87
     clon: i64,
109 88
     keys_vals_slice: &'a [i32],
110 89
     keys_vals_index: usize,
90
+    info_iter: Option<DenseNodeInfoIter<'a>>,
111 91
 }
112 92
 
113 93
 impl<'a> DenseNodeIter<'a> {
@@ -115,26 +95,18 @@ impl<'a> DenseNodeIter<'a> {
115 95
         block: &'a osmformat::PrimitiveBlock,
116 96
         osmdense: &'a osmformat::DenseNodes,
117 97
     ) -> DenseNodeIter<'a> {
118
-        let info = osmdense.get_denseinfo();
98
+        let info_iter = Some(DenseNodeInfoIter::new(block, osmdense.get_denseinfo()));
119 99
         DenseNodeIter {
120 100
             block,
121 101
             dids: osmdense.get_id().iter(),
122 102
             cid: 0,
123
-            versions: info.get_version().iter(),
124
-            dtimestamps: info.get_timestamp().iter(),
125
-            ctimestamp: 0,
126
-            dchangesets: info.get_changeset().iter(),
127
-            cchangeset: 0,
128
-            duids: info.get_uid().iter(),
129
-            cuid: 0,
130
-            duser_sids: info.get_user_sid().iter(),
131
-            cuser_sid: 0,
132 103
             dlats: osmdense.get_lat().iter(),
133 104
             clat: 0,
134 105
             dlons: osmdense.get_lon().iter(),
135 106
             clon: 0,
136 107
             keys_vals_slice: osmdense.get_keys_vals(),
137 108
             keys_vals_index: 0,
109
+            info_iter,
138 110
         }
139 111
     }
140 112
 
@@ -143,21 +115,13 @@ impl<'a> DenseNodeIter<'a> {
143 115
             block,
144 116
             dids: [].iter(),
145 117
             cid: 0,
146
-            versions: [].iter(),
147
-            dtimestamps: [].iter(),
148
-            ctimestamp: 0,
149
-            dchangesets: [].iter(),
150
-            cchangeset: 0,
151
-            duids: [].iter(),
152
-            cuid: 0,
153
-            duser_sids: [].iter(),
154
-            cuser_sid: 0,
155 118
             dlats: [].iter(),
156 119
             clat: 0,
157 120
             dlons: [].iter(),
158 121
             clon: 0,
159 122
             keys_vals_slice: &[],
160 123
             keys_vals_index: 0,
124
+            info_iter: None,
161 125
         }
162 126
     }
163 127
 }
@@ -168,29 +132,12 @@ impl<'a> Iterator for DenseNodeIter<'a> {
168 132
     fn next(&mut self) -> Option<Self::Item> {
169 133
         match (
170 134
             self.dids.next(),
171
-            self.versions.next(),
172
-            self.dtimestamps.next(),
173
-            self.dchangesets.next(),
174
-            self.duids.next(),
175
-            self.duser_sids.next(),
176 135
             self.dlats.next(),
177 136
             self.dlons.next(),
137
+            self.info_iter.as_mut().and_then(|iter| iter.next()),
178 138
         ) {
179
-            (
180
-                Some(did),
181
-                Some(version),
182
-                Some(dtimestamp),
183
-                Some(dchangeset),
184
-                Some(duid),
185
-                Some(duser_sid),
186
-                Some(dlat),
187
-                Some(dlon),
188
-            ) => {
139
+            (Some(did), Some(dlat), Some(dlon), info) => {
189 140
                 self.cid += *did;
190
-                self.ctimestamp += *dtimestamp;
191
-                self.cchangeset += *dchangeset;
192
-                self.cuid += *duid;
193
-                self.cuser_sid += *duser_sid;
194 141
                 self.clat += *dlat;
195 142
                 self.clon += *dlon;
196 143
 
@@ -209,14 +156,10 @@ impl<'a> Iterator for DenseNodeIter<'a> {
209 156
                 Some(DenseNode {
210 157
                     block: self.block,
211 158
                     id: self.cid,
212
-                    version: *version,
213
-                    timestamp: self.ctimestamp,
214
-                    changeset: self.cchangeset,
215
-                    uid: self.cuid,
216
-                    user_sid: self.cuser_sid,
217 159
                     lat: self.clat,
218 160
                     lon: self.clon,
219 161
                     keys_vals_indices: &self.keys_vals_slice[start_index..end_index],
162
+                    info,
220 163
                 })
221 164
             }
222 165
             _ => None,
@@ -230,6 +173,114 @@ impl<'a> Iterator for DenseNodeIter<'a> {
230 173
 
231 174
 impl<'a> ExactSizeIterator for DenseNodeIter<'a> {}
232 175
 
176
+/// Optional metadata with non-geographic information about a dense node
177
+#[derive(Clone, Debug)]
178
+pub struct DenseNodeInfo<'a> {
179
+    block: &'a osmformat::PrimitiveBlock,
180
+    /// The version of this element.
181
+    version: i32,
182
+    /// Timestamp
183
+    timestamp: i64,
184
+    /// The changeset id.
185
+    changeset: i64,
186
+    /// The user id.
187
+    uid: i32,
188
+    // String IDs for usernames.
189
+    user_sid: i32,
190
+}
191
+
192
+impl<'a> DenseNodeInfo<'a> {
193
+    /// Returns the version of this element.
194
+    pub fn version(&self) -> i32 {
195
+        self.version
196
+    }
197
+
198
+    /// Returns the changeset id.
199
+    pub fn changeset(&self) -> i64 {
200
+        self.changeset
201
+    }
202
+
203
+    /// Returns the user id.
204
+    pub fn uid(&self) -> i32 {
205
+        self.uid
206
+    }
207
+
208
+    /// Returns the user name.
209
+    pub fn user(&self) -> Result<&'a str> {
210
+        str_from_stringtable(self.block, self.user_sid as usize)
211
+    }
212
+
213
+    /// Returns the time stamp in milliseconds since the epoch.
214
+    pub fn milli_timestamp(&self) -> i64 {
215
+        self.timestamp * i64::from(self.block.get_date_granularity())
216
+    }
217
+}
218
+
219
+/// An iterator over dense nodes info. It decodes the delta encoded values.
220
+#[derive(Clone, Debug)]
221
+pub struct DenseNodeInfoIter<'a> {
222
+    block: &'a osmformat::PrimitiveBlock,
223
+    versions: std::slice::Iter<'a, i32>,
224
+    dtimestamps: std::slice::Iter<'a, i64>, // deltas
225
+    ctimestamp: i64,
226
+    dchangesets: std::slice::Iter<'a, i64>, // deltas
227
+    cchangeset: i64,
228
+    duids: std::slice::Iter<'a, i32>, // deltas
229
+    cuid: i32,
230
+    duser_sids: std::slice::Iter<'a, i32>, // deltas
231
+    cuser_sid: i32,
232
+}
233
+
234
+impl<'a> DenseNodeInfoIter<'a> {
235
+    fn new(
236
+        block: &'a osmformat::PrimitiveBlock,
237
+        info: &'a osmformat::DenseInfo,
238
+    ) -> DenseNodeInfoIter<'a> {
239
+        DenseNodeInfoIter {
240
+            block,
241
+            versions: info.get_version().iter(),
242
+            dtimestamps: info.get_timestamp().iter(),
243
+            ctimestamp: 0,
244
+            dchangesets: info.get_changeset().iter(),
245
+            cchangeset: 0,
246
+            duids: info.get_uid().iter(),
247
+            cuid: 0,
248
+            duser_sids: info.get_user_sid().iter(),
249
+            cuser_sid: 0,
250
+        }
251
+    }
252
+}
253
+
254
+impl<'a> Iterator for DenseNodeInfoIter<'a> {
255
+    type Item = DenseNodeInfo<'a>;
256
+
257
+    fn next(&mut self) -> Option<Self::Item> {
258
+        match (
259
+            self.versions.next(),
260
+            self.dtimestamps.next(),
261
+            self.dchangesets.next(),
262
+            self.duids.next(),
263
+            self.duser_sids.next(),
264
+        ) {
265
+            (Some(&version), Some(dtimestamp), Some(dchangeset), Some(duid), Some(duser_sid)) => {
266
+                self.ctimestamp += *dtimestamp;
267
+                self.cchangeset += *dchangeset;
268
+                self.cuid += *duid;
269
+                self.cuser_sid += *duser_sid;
270
+                Some(DenseNodeInfo {
271
+                    block: self.block,
272
+                    version,
273
+                    timestamp: self.ctimestamp,
274
+                    changeset: self.cchangeset,
275
+                    uid: self.cuid,
276
+                    user_sid: self.cuser_sid,
277
+                })
278
+            }
279
+            _ => None,
280
+        }
281
+    }
282
+}
283
+
233 284
 /// An iterator over the tags in a dense node.
234 285
 #[derive(Clone, Debug)]
235 286
 pub struct DenseTagIter<'a> {

+ 9
- 5
src/lib.rs Zobrazit soubor

@@ -7,7 +7,7 @@ Add this to your `Cargo.toml`:
7 7
 
8 8
 ```toml
9 9
 [dependencies]
10
-osmpbf = "0.1"
10
+osmpbf = "0.2"
11 11
 ```
12 12
 
13 13
 and if you're using Rust 2015, add this line to the crate root:
@@ -24,7 +24,7 @@ file:
24 24
 ```rust
25 25
 use osmpbf::{ElementReader, Element};
26 26
 
27
-let reader = ElementReader::from_path("tests/test.osm.pbf").unwrap();
27
+let reader = ElementReader::from_path("tests/test.osm.pbf")?;
28 28
 let mut ways = 0_u64;
29 29
 
30 30
 // Increment the counter by one for each way.
@@ -32,9 +32,11 @@ reader.for_each(|element| {
32 32
     if let Element::Way(_) = element {
33 33
         ways += 1;
34 34
     }
35
-}).unwrap();
35
+})?;
36 36
 
37 37
 println!("Number of ways: {}", ways);
38
+# assert_eq!(ways, 1);
39
+# Ok::<(), std::io::Error>(())
38 40
 ```
39 41
 
40 42
 ## Example: Count ways in parallel
@@ -45,7 +47,7 @@ decoding the file in parallel:
45 47
 ```rust
46 48
 use osmpbf::{ElementReader, Element};
47 49
 
48
-let reader = ElementReader::from_path("tests/test.osm.pbf").unwrap();
50
+let reader = ElementReader::from_path("tests/test.osm.pbf")?;
49 51
 
50 52
 // Count the ways
51 53
 let ways = reader.par_map_reduce(
@@ -57,9 +59,11 @@ let ways = reader.par_map_reduce(
57 59
     },
58 60
     || 0_u64,      // Zero is the identity value for addition
59 61
     |a, b| a + b   // Sum the partial results
60
-).unwrap();
62
+)?;
61 63
 
62 64
 println!("Number of ways: {}", ways);
65
+# assert_eq!(ways, 1);
66
+# Ok::<(), std::io::Error>(())
63 67
 ```
64 68
 */
65 69
 

+ 14
- 27
src/proto/fileformat.rs Zobrazit soubor

@@ -1,11 +1,12 @@
1
-// This file is generated by rust-protobuf 2.10.1. Do not edit
1
+// This file is generated by rust-protobuf 2.17.0. Do not edit
2 2
 // @generated
3 3
 
4 4
 // https://github.com/rust-lang/rust-clippy/issues/702
5 5
 #![allow(unknown_lints)]
6 6
 #![allow(clippy::all)]
7 7
 
8
-#![cfg_attr(rustfmt, rustfmt_skip)]
8
+#![allow(unused_attributes)]
9
+#![rustfmt::skip]
9 10
 
10 11
 #![allow(box_pointers)]
11 12
 #![allow(dead_code)]
@@ -14,17 +15,13 @@
14 15
 #![allow(non_snake_case)]
15 16
 #![allow(non_upper_case_globals)]
16 17
 #![allow(trivial_casts)]
17
-#![allow(unsafe_code)]
18 18
 #![allow(unused_imports)]
19 19
 #![allow(unused_results)]
20 20
 //! Generated file from `src/proto/fileformat.proto`
21 21
 
22
-use protobuf::Message as Message_imported_for_functions;
23
-use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
24
-
25 22
 /// Generated files are compatible only with the same version
26 23
 /// of protobuf runtime.
27
-// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1;
24
+// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_17_0;
28 25
 
29 26
 #[derive(PartialEq,Clone,Default,Debug)]
30 27
 pub struct Blob {
@@ -312,7 +309,7 @@ impl ::protobuf::Message for Blob {
312 309
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
313 310
         self as &mut dyn (::std::any::Any)
314 311
     }
315
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
312
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
316 313
         self
317 314
     }
318 315
 
@@ -325,13 +322,8 @@ impl ::protobuf::Message for Blob {
325 322
     }
326 323
 
327 324
     fn default_instance() -> &'static Blob {
328
-        static mut instance: ::protobuf::lazy::Lazy<Blob> = ::protobuf::lazy::Lazy {
329
-            lock: ::protobuf::lazy::ONCE_INIT,
330
-            ptr: 0 as *const Blob,
331
-        };
332
-        unsafe {
333
-            instance.get(Blob::new)
334
-        }
325
+        static instance: ::protobuf::rt::LazyV2<Blob> = ::protobuf::rt::LazyV2::INIT;
326
+        instance.get(Blob::new)
335 327
     }
336 328
 }
337 329
 
@@ -347,8 +339,8 @@ impl ::protobuf::Clear for Blob {
347 339
 }
348 340
 
349 341
 impl ::protobuf::reflect::ProtobufValue for Blob {
350
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
351
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
342
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
343
+        ::protobuf::reflect::ReflectValueRef::Message(self)
352 344
     }
353 345
 }
354 346
 
@@ -552,7 +544,7 @@ impl ::protobuf::Message for BlobHeader {
552 544
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
553 545
         self as &mut dyn (::std::any::Any)
554 546
     }
555
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
547
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
556 548
         self
557 549
     }
558 550
 
@@ -565,13 +557,8 @@ impl ::protobuf::Message for BlobHeader {
565 557
     }
566 558
 
567 559
     fn default_instance() -> &'static BlobHeader {
568
-        static mut instance: ::protobuf::lazy::Lazy<BlobHeader> = ::protobuf::lazy::Lazy {
569
-            lock: ::protobuf::lazy::ONCE_INIT,
570
-            ptr: 0 as *const BlobHeader,
571
-        };
572
-        unsafe {
573
-            instance.get(BlobHeader::new)
574
-        }
560
+        static instance: ::protobuf::rt::LazyV2<BlobHeader> = ::protobuf::rt::LazyV2::INIT;
561
+        instance.get(BlobHeader::new)
575 562
     }
576 563
 }
577 564
 
@@ -585,7 +572,7 @@ impl ::protobuf::Clear for BlobHeader {
585 572
 }
586 573
 
587 574
 impl ::protobuf::reflect::ProtobufValue for BlobHeader {
588
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
589
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
575
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
576
+        ::protobuf::reflect::ReflectValueRef::Message(self)
590 577
     }
591 578
 }

+ 109
- 172
src/proto/osmformat.rs Zobrazit soubor

@@ -1,11 +1,12 @@
1
-// This file is generated by rust-protobuf 2.10.1. Do not edit
1
+// This file is generated by rust-protobuf 2.17.0. Do not edit
2 2
 // @generated
3 3
 
4 4
 // https://github.com/rust-lang/rust-clippy/issues/702
5 5
 #![allow(unknown_lints)]
6 6
 #![allow(clippy::all)]
7 7
 
8
-#![cfg_attr(rustfmt, rustfmt_skip)]
8
+#![allow(unused_attributes)]
9
+#![rustfmt::skip]
9 10
 
10 11
 #![allow(box_pointers)]
11 12
 #![allow(dead_code)]
@@ -14,24 +15,20 @@
14 15
 #![allow(non_snake_case)]
15 16
 #![allow(non_upper_case_globals)]
16 17
 #![allow(trivial_casts)]
17
-#![allow(unsafe_code)]
18 18
 #![allow(unused_imports)]
19 19
 #![allow(unused_results)]
20 20
 //! Generated file from `src/proto/osmformat.proto`
21 21
 
22
-use protobuf::Message as Message_imported_for_functions;
23
-use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
24
-
25 22
 /// Generated files are compatible only with the same version
26 23
 /// of protobuf runtime.
27
-// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_1;
24
+// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_17_0;
28 25
 
29 26
 #[derive(PartialEq,Clone,Default,Debug)]
30 27
 pub struct HeaderBlock {
31 28
     // message fields
32
-    bbox: ::protobuf::SingularPtrField<HeaderBBox>,
33
-    required_features: ::protobuf::RepeatedField<::std::string::String>,
34
-    optional_features: ::protobuf::RepeatedField<::std::string::String>,
29
+    pub bbox: ::protobuf::SingularPtrField<HeaderBBox>,
30
+    pub required_features: ::protobuf::RepeatedField<::std::string::String>,
31
+    pub optional_features: ::protobuf::RepeatedField<::std::string::String>,
35 32
     writingprogram: ::protobuf::SingularField<::std::string::String>,
36 33
     source: ::protobuf::SingularField<::std::string::String>,
37 34
     osmosis_replication_timestamp: ::std::option::Option<i64>,
@@ -57,7 +54,7 @@ impl HeaderBlock {
57 54
 
58 55
 
59 56
     pub fn get_bbox(&self) -> &HeaderBBox {
60
-        self.bbox.as_ref().unwrap_or_else(|| HeaderBBox::default_instance())
57
+        self.bbox.as_ref().unwrap_or_else(|| <HeaderBBox as ::protobuf::Message>::default_instance())
61 58
     }
62 59
     pub fn clear_bbox(&mut self) {
63 60
         self.bbox.clear();
@@ -420,7 +417,7 @@ impl ::protobuf::Message for HeaderBlock {
420 417
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
421 418
         self as &mut dyn (::std::any::Any)
422 419
     }
423
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
420
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
424 421
         self
425 422
     }
426 423
 
@@ -433,13 +430,8 @@ impl ::protobuf::Message for HeaderBlock {
433 430
     }
434 431
 
435 432
     fn default_instance() -> &'static HeaderBlock {
436
-        static mut instance: ::protobuf::lazy::Lazy<HeaderBlock> = ::protobuf::lazy::Lazy {
437
-            lock: ::protobuf::lazy::ONCE_INIT,
438
-            ptr: 0 as *const HeaderBlock,
439
-        };
440
-        unsafe {
441
-            instance.get(HeaderBlock::new)
442
-        }
433
+        static instance: ::protobuf::rt::LazyV2<HeaderBlock> = ::protobuf::rt::LazyV2::INIT;
434
+        instance.get(HeaderBlock::new)
443 435
     }
444 436
 }
445 437
 
@@ -458,8 +450,8 @@ impl ::protobuf::Clear for HeaderBlock {
458 450
 }
459 451
 
460 452
 impl ::protobuf::reflect::ProtobufValue for HeaderBlock {
461
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
462
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
453
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
454
+        ::protobuf::reflect::ReflectValueRef::Message(self)
463 455
     }
464 456
 }
465 457
 
@@ -676,7 +668,7 @@ impl ::protobuf::Message for HeaderBBox {
676 668
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
677 669
         self as &mut dyn (::std::any::Any)
678 670
     }
679
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
671
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
680 672
         self
681 673
     }
682 674
 
@@ -689,13 +681,8 @@ impl ::protobuf::Message for HeaderBBox {
689 681
     }
690 682
 
691 683
     fn default_instance() -> &'static HeaderBBox {
692
-        static mut instance: ::protobuf::lazy::Lazy<HeaderBBox> = ::protobuf::lazy::Lazy {
693
-            lock: ::protobuf::lazy::ONCE_INIT,
694
-            ptr: 0 as *const HeaderBBox,
695
-        };
696
-        unsafe {
697
-            instance.get(HeaderBBox::new)
698
-        }
684
+        static instance: ::protobuf::rt::LazyV2<HeaderBBox> = ::protobuf::rt::LazyV2::INIT;
685
+        instance.get(HeaderBBox::new)
699 686
     }
700 687
 }
701 688
 
@@ -710,16 +697,16 @@ impl ::protobuf::Clear for HeaderBBox {
710 697
 }
711 698
 
712 699
 impl ::protobuf::reflect::ProtobufValue for HeaderBBox {
713
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
714
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
700
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
701
+        ::protobuf::reflect::ReflectValueRef::Message(self)
715 702
     }
716 703
 }
717 704
 
718 705
 #[derive(PartialEq,Clone,Default,Debug)]
719 706
 pub struct PrimitiveBlock {
720 707
     // message fields
721
-    stringtable: ::protobuf::SingularPtrField<StringTable>,
722
-    primitivegroup: ::protobuf::RepeatedField<PrimitiveGroup>,
708
+    pub stringtable: ::protobuf::SingularPtrField<StringTable>,
709
+    pub primitivegroup: ::protobuf::RepeatedField<PrimitiveGroup>,
723 710
     granularity: ::std::option::Option<i32>,
724 711
     lat_offset: ::std::option::Option<i64>,
725 712
     lon_offset: ::std::option::Option<i64>,
@@ -744,7 +731,7 @@ impl PrimitiveBlock {
744 731
 
745 732
 
746 733
     pub fn get_stringtable(&self) -> &StringTable {
747
-        self.stringtable.as_ref().unwrap_or_else(|| StringTable::default_instance())
734
+        self.stringtable.as_ref().unwrap_or_else(|| <StringTable as ::protobuf::Message>::default_instance())
748 735
     }
749 736
     pub fn clear_stringtable(&mut self) {
750 737
         self.stringtable.clear();
@@ -1013,7 +1000,7 @@ impl ::protobuf::Message for PrimitiveBlock {
1013 1000
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1014 1001
         self as &mut dyn (::std::any::Any)
1015 1002
     }
1016
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1003
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1017 1004
         self
1018 1005
     }
1019 1006
 
@@ -1026,13 +1013,8 @@ impl ::protobuf::Message for PrimitiveBlock {
1026 1013
     }
1027 1014
 
1028 1015
     fn default_instance() -> &'static PrimitiveBlock {
1029
-        static mut instance: ::protobuf::lazy::Lazy<PrimitiveBlock> = ::protobuf::lazy::Lazy {
1030
-            lock: ::protobuf::lazy::ONCE_INIT,
1031
-            ptr: 0 as *const PrimitiveBlock,
1032
-        };
1033
-        unsafe {
1034
-            instance.get(PrimitiveBlock::new)
1035
-        }
1016
+        static instance: ::protobuf::rt::LazyV2<PrimitiveBlock> = ::protobuf::rt::LazyV2::INIT;
1017
+        instance.get(PrimitiveBlock::new)
1036 1018
     }
1037 1019
 }
1038 1020
 
@@ -1049,19 +1031,19 @@ impl ::protobuf::Clear for PrimitiveBlock {
1049 1031
 }
1050 1032
 
1051 1033
 impl ::protobuf::reflect::ProtobufValue for PrimitiveBlock {
1052
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
1053
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
1034
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
1035
+        ::protobuf::reflect::ReflectValueRef::Message(self)
1054 1036
     }
1055 1037
 }
1056 1038
 
1057 1039
 #[derive(PartialEq,Clone,Default,Debug)]
1058 1040
 pub struct PrimitiveGroup {
1059 1041
     // message fields
1060
-    nodes: ::protobuf::RepeatedField<Node>,
1061
-    dense: ::protobuf::SingularPtrField<DenseNodes>,
1062
-    ways: ::protobuf::RepeatedField<Way>,
1063
-    relations: ::protobuf::RepeatedField<Relation>,
1064
-    changesets: ::protobuf::RepeatedField<ChangeSet>,
1042
+    pub nodes: ::protobuf::RepeatedField<Node>,
1043
+    pub dense: ::protobuf::SingularPtrField<DenseNodes>,
1044
+    pub ways: ::protobuf::RepeatedField<Way>,
1045
+    pub relations: ::protobuf::RepeatedField<Relation>,
1046
+    pub changesets: ::protobuf::RepeatedField<ChangeSet>,
1065 1047
     // special fields
1066 1048
     pub unknown_fields: ::protobuf::UnknownFields,
1067 1049
     pub cached_size: ::protobuf::CachedSize,
@@ -1107,7 +1089,7 @@ impl PrimitiveGroup {
1107 1089
 
1108 1090
 
1109 1091
     pub fn get_dense(&self) -> &DenseNodes {
1110
-        self.dense.as_ref().unwrap_or_else(|| DenseNodes::default_instance())
1092
+        self.dense.as_ref().unwrap_or_else(|| <DenseNodes as ::protobuf::Message>::default_instance())
1111 1093
     }
1112 1094
     pub fn clear_dense(&mut self) {
1113 1095
         self.dense.clear();
@@ -1346,7 +1328,7 @@ impl ::protobuf::Message for PrimitiveGroup {
1346 1328
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1347 1329
         self as &mut dyn (::std::any::Any)
1348 1330
     }
1349
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1331
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1350 1332
         self
1351 1333
     }
1352 1334
 
@@ -1359,13 +1341,8 @@ impl ::protobuf::Message for PrimitiveGroup {
1359 1341
     }
1360 1342
 
1361 1343
     fn default_instance() -> &'static PrimitiveGroup {
1362
-        static mut instance: ::protobuf::lazy::Lazy<PrimitiveGroup> = ::protobuf::lazy::Lazy {
1363
-            lock: ::protobuf::lazy::ONCE_INIT,
1364
-            ptr: 0 as *const PrimitiveGroup,
1365
-        };
1366
-        unsafe {
1367
-            instance.get(PrimitiveGroup::new)
1368
-        }
1344
+        static instance: ::protobuf::rt::LazyV2<PrimitiveGroup> = ::protobuf::rt::LazyV2::INIT;
1345
+        instance.get(PrimitiveGroup::new)
1369 1346
     }
1370 1347
 }
1371 1348
 
@@ -1381,15 +1358,15 @@ impl ::protobuf::Clear for PrimitiveGroup {
1381 1358
 }
1382 1359
 
1383 1360
 impl ::protobuf::reflect::ProtobufValue for PrimitiveGroup {
1384
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
1385
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
1361
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
1362
+        ::protobuf::reflect::ReflectValueRef::Message(self)
1386 1363
     }
1387 1364
 }
1388 1365
 
1389 1366
 #[derive(PartialEq,Clone,Default,Debug)]
1390 1367
 pub struct StringTable {
1391 1368
     // message fields
1392
-    s: ::protobuf::RepeatedField<::std::vec::Vec<u8>>,
1369
+    pub s: ::protobuf::RepeatedField<::std::vec::Vec<u8>>,
1393 1370
     // special fields
1394 1371
     pub unknown_fields: ::protobuf::UnknownFields,
1395 1372
     pub cached_size: ::protobuf::CachedSize,
@@ -1490,7 +1467,7 @@ impl ::protobuf::Message for StringTable {
1490 1467
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1491 1468
         self as &mut dyn (::std::any::Any)
1492 1469
     }
1493
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1470
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1494 1471
         self
1495 1472
     }
1496 1473
 
@@ -1503,13 +1480,8 @@ impl ::protobuf::Message for StringTable {
1503 1480
     }
1504 1481
 
1505 1482
     fn default_instance() -> &'static StringTable {
1506
-        static mut instance: ::protobuf::lazy::Lazy<StringTable> = ::protobuf::lazy::Lazy {
1507
-            lock: ::protobuf::lazy::ONCE_INIT,
1508
-            ptr: 0 as *const StringTable,
1509
-        };
1510
-        unsafe {
1511
-            instance.get(StringTable::new)
1512
-        }
1483
+        static instance: ::protobuf::rt::LazyV2<StringTable> = ::protobuf::rt::LazyV2::INIT;
1484
+        instance.get(StringTable::new)
1513 1485
     }
1514 1486
 }
1515 1487
 
@@ -1521,8 +1493,8 @@ impl ::protobuf::Clear for StringTable {
1521 1493
 }
1522 1494
 
1523 1495
 impl ::protobuf::reflect::ProtobufValue for StringTable {
1524
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
1525
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
1496
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
1497
+        ::protobuf::reflect::ReflectValueRef::Message(self)
1526 1498
     }
1527 1499
 }
1528 1500
 
@@ -1793,7 +1765,7 @@ impl ::protobuf::Message for Info {
1793 1765
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1794 1766
         self as &mut dyn (::std::any::Any)
1795 1767
     }
1796
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1768
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
1797 1769
         self
1798 1770
     }
1799 1771
 
@@ -1806,13 +1778,8 @@ impl ::protobuf::Message for Info {
1806 1778
     }
1807 1779
 
1808 1780
     fn default_instance() -> &'static Info {
1809
-        static mut instance: ::protobuf::lazy::Lazy<Info> = ::protobuf::lazy::Lazy {
1810
-            lock: ::protobuf::lazy::ONCE_INIT,
1811
-            ptr: 0 as *const Info,
1812
-        };
1813
-        unsafe {
1814
-            instance.get(Info::new)
1815
-        }
1781
+        static instance: ::protobuf::rt::LazyV2<Info> = ::protobuf::rt::LazyV2::INIT;
1782
+        instance.get(Info::new)
1816 1783
     }
1817 1784
 }
1818 1785
 
@@ -1829,20 +1796,20 @@ impl ::protobuf::Clear for Info {
1829 1796
 }
1830 1797
 
1831 1798
 impl ::protobuf::reflect::ProtobufValue for Info {
1832
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
1833
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
1799
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
1800
+        ::protobuf::reflect::ReflectValueRef::Message(self)
1834 1801
     }
1835 1802
 }
1836 1803
 
1837 1804
 #[derive(PartialEq,Clone,Default,Debug)]
1838 1805
 pub struct DenseInfo {
1839 1806
     // message fields
1840
-    version: ::std::vec::Vec<i32>,
1841
-    timestamp: ::std::vec::Vec<i64>,
1842
-    changeset: ::std::vec::Vec<i64>,
1843
-    uid: ::std::vec::Vec<i32>,
1844
-    user_sid: ::std::vec::Vec<i32>,
1845
-    visible: ::std::vec::Vec<bool>,
1807
+    pub version: ::std::vec::Vec<i32>,
1808
+    pub timestamp: ::std::vec::Vec<i64>,
1809
+    pub changeset: ::std::vec::Vec<i64>,
1810
+    pub uid: ::std::vec::Vec<i32>,
1811
+    pub user_sid: ::std::vec::Vec<i32>,
1812
+    pub visible: ::std::vec::Vec<bool>,
1846 1813
     // special fields
1847 1814
     pub unknown_fields: ::protobuf::UnknownFields,
1848 1815
     pub cached_size: ::protobuf::CachedSize,
@@ -2143,7 +2110,7 @@ impl ::protobuf::Message for DenseInfo {
2143 2110
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2144 2111
         self as &mut dyn (::std::any::Any)
2145 2112
     }
2146
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2113
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2147 2114
         self
2148 2115
     }
2149 2116
 
@@ -2156,13 +2123,8 @@ impl ::protobuf::Message for DenseInfo {
2156 2123
     }
2157 2124
 
2158 2125
     fn default_instance() -> &'static DenseInfo {
2159
-        static mut instance: ::protobuf::lazy::Lazy<DenseInfo> = ::protobuf::lazy::Lazy {
2160
-            lock: ::protobuf::lazy::ONCE_INIT,
2161
-            ptr: 0 as *const DenseInfo,
2162
-        };
2163
-        unsafe {
2164
-            instance.get(DenseInfo::new)
2165
-        }
2126
+        static instance: ::protobuf::rt::LazyV2<DenseInfo> = ::protobuf::rt::LazyV2::INIT;
2127
+        instance.get(DenseInfo::new)
2166 2128
     }
2167 2129
 }
2168 2130
 
@@ -2179,8 +2141,8 @@ impl ::protobuf::Clear for DenseInfo {
2179 2141
 }
2180 2142
 
2181 2143
 impl ::protobuf::reflect::ProtobufValue for DenseInfo {
2182
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
2183
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
2144
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
2145
+        ::protobuf::reflect::ReflectValueRef::Message(self)
2184 2146
     }
2185 2147
 }
2186 2148
 
@@ -2289,7 +2251,7 @@ impl ::protobuf::Message for ChangeSet {
2289 2251
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2290 2252
         self as &mut dyn (::std::any::Any)
2291 2253
     }
2292
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2254
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2293 2255
         self
2294 2256
     }
2295 2257
 
@@ -2302,13 +2264,8 @@ impl ::protobuf::Message for ChangeSet {
2302 2264
     }
2303 2265
 
2304 2266
     fn default_instance() -> &'static ChangeSet {
2305
-        static mut instance: ::protobuf::lazy::Lazy<ChangeSet> = ::protobuf::lazy::Lazy {
2306
-            lock: ::protobuf::lazy::ONCE_INIT,
2307
-            ptr: 0 as *const ChangeSet,
2308
-        };
2309
-        unsafe {
2310
-            instance.get(ChangeSet::new)
2311
-        }
2267
+        static instance: ::protobuf::rt::LazyV2<ChangeSet> = ::protobuf::rt::LazyV2::INIT;
2268
+        instance.get(ChangeSet::new)
2312 2269
     }
2313 2270
 }
2314 2271
 
@@ -2320,8 +2277,8 @@ impl ::protobuf::Clear for ChangeSet {
2320 2277
 }
2321 2278
 
2322 2279
 impl ::protobuf::reflect::ProtobufValue for ChangeSet {
2323
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
2324
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
2280
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
2281
+        ::protobuf::reflect::ReflectValueRef::Message(self)
2325 2282
     }
2326 2283
 }
2327 2284
 
@@ -2329,9 +2286,9 @@ impl ::protobuf::reflect::ProtobufValue for ChangeSet {
2329 2286
 pub struct Node {
2330 2287
     // message fields
2331 2288
     id: ::std::option::Option<i64>,
2332
-    keys: ::std::vec::Vec<u32>,
2333
-    vals: ::std::vec::Vec<u32>,
2334
-    info: ::protobuf::SingularPtrField<Info>,
2289
+    pub keys: ::std::vec::Vec<u32>,
2290
+    pub vals: ::std::vec::Vec<u32>,
2291
+    pub info: ::protobuf::SingularPtrField<Info>,
2335 2292
     lat: ::std::option::Option<i64>,
2336 2293
     lon: ::std::option::Option<i64>,
2337 2294
     // special fields
@@ -2423,7 +2380,7 @@ impl Node {
2423 2380
 
2424 2381
 
2425 2382
     pub fn get_info(&self) -> &Info {
2426
-        self.info.as_ref().unwrap_or_else(|| Info::default_instance())
2383
+        self.info.as_ref().unwrap_or_else(|| <Info as ::protobuf::Message>::default_instance())
2427 2384
     }
2428 2385
     pub fn clear_info(&mut self) {
2429 2386
         self.info.clear();
@@ -2633,7 +2590,7 @@ impl ::protobuf::Message for Node {
2633 2590
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2634 2591
         self as &mut dyn (::std::any::Any)
2635 2592
     }
2636
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2593
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2637 2594
         self
2638 2595
     }
2639 2596
 
@@ -2646,13 +2603,8 @@ impl ::protobuf::Message for Node {
2646 2603
     }
2647 2604
 
2648 2605
     fn default_instance() -> &'static Node {
2649
-        static mut instance: ::protobuf::lazy::Lazy<Node> = ::protobuf::lazy::Lazy {
2650
-            lock: ::protobuf::lazy::ONCE_INIT,
2651
-            ptr: 0 as *const Node,
2652
-        };
2653
-        unsafe {
2654
-            instance.get(Node::new)
2655
-        }
2606
+        static instance: ::protobuf::rt::LazyV2<Node> = ::protobuf::rt::LazyV2::INIT;
2607
+        instance.get(Node::new)
2656 2608
     }
2657 2609
 }
2658 2610
 
@@ -2669,19 +2621,19 @@ impl ::protobuf::Clear for Node {
2669 2621
 }
2670 2622
 
2671 2623
 impl ::protobuf::reflect::ProtobufValue for Node {
2672
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
2673
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
2624
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
2625
+        ::protobuf::reflect::ReflectValueRef::Message(self)
2674 2626
     }
2675 2627
 }
2676 2628
 
2677 2629
 #[derive(PartialEq,Clone,Default,Debug)]
2678 2630
 pub struct DenseNodes {
2679 2631
     // message fields
2680
-    id: ::std::vec::Vec<i64>,
2681
-    denseinfo: ::protobuf::SingularPtrField<DenseInfo>,
2682
-    lat: ::std::vec::Vec<i64>,
2683
-    lon: ::std::vec::Vec<i64>,
2684
-    keys_vals: ::std::vec::Vec<i32>,
2632
+    pub id: ::std::vec::Vec<i64>,
2633
+    pub denseinfo: ::protobuf::SingularPtrField<DenseInfo>,
2634
+    pub lat: ::std::vec::Vec<i64>,
2635
+    pub lon: ::std::vec::Vec<i64>,
2636
+    pub keys_vals: ::std::vec::Vec<i32>,
2685 2637
     // special fields
2686 2638
     pub unknown_fields: ::protobuf::UnknownFields,
2687 2639
     pub cached_size: ::protobuf::CachedSize,
@@ -2727,7 +2679,7 @@ impl DenseNodes {
2727 2679
 
2728 2680
 
2729 2681
     pub fn get_denseinfo(&self) -> &DenseInfo {
2730
-        self.denseinfo.as_ref().unwrap_or_else(|| DenseInfo::default_instance())
2682
+        self.denseinfo.as_ref().unwrap_or_else(|| <DenseInfo as ::protobuf::Message>::default_instance())
2731 2683
     }
2732 2684
     pub fn clear_denseinfo(&mut self) {
2733 2685
         self.denseinfo.clear();
@@ -2954,7 +2906,7 @@ impl ::protobuf::Message for DenseNodes {
2954 2906
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2955 2907
         self as &mut dyn (::std::any::Any)
2956 2908
     }
2957
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2909
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
2958 2910
         self
2959 2911
     }
2960 2912
 
@@ -2967,13 +2919,8 @@ impl ::protobuf::Message for DenseNodes {
2967 2919
     }
2968 2920
 
2969 2921
     fn default_instance() -> &'static DenseNodes {
2970
-        static mut instance: ::protobuf::lazy::Lazy<DenseNodes> = ::protobuf::lazy::Lazy {
2971
-            lock: ::protobuf::lazy::ONCE_INIT,
2972
-            ptr: 0 as *const DenseNodes,
2973
-        };
2974
-        unsafe {
2975
-            instance.get(DenseNodes::new)
2976
-        }
2922
+        static instance: ::protobuf::rt::LazyV2<DenseNodes> = ::protobuf::rt::LazyV2::INIT;
2923
+        instance.get(DenseNodes::new)
2977 2924
     }
2978 2925
 }
2979 2926
 
@@ -2989,8 +2936,8 @@ impl ::protobuf::Clear for DenseNodes {
2989 2936
 }
2990 2937
 
2991 2938
 impl ::protobuf::reflect::ProtobufValue for DenseNodes {
2992
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
2993
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
2939
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
2940
+        ::protobuf::reflect::ReflectValueRef::Message(self)
2994 2941
     }
2995 2942
 }
2996 2943
 
@@ -2998,10 +2945,10 @@ impl ::protobuf::reflect::ProtobufValue for DenseNodes {
2998 2945
 pub struct Way {
2999 2946
     // message fields
3000 2947
     id: ::std::option::Option<i64>,
3001
-    keys: ::std::vec::Vec<u32>,
3002
-    vals: ::std::vec::Vec<u32>,
3003
-    info: ::protobuf::SingularPtrField<Info>,
3004
-    refs: ::std::vec::Vec<i64>,
2948
+    pub keys: ::std::vec::Vec<u32>,
2949
+    pub vals: ::std::vec::Vec<u32>,
2950
+    pub info: ::protobuf::SingularPtrField<Info>,
2951
+    pub refs: ::std::vec::Vec<i64>,
3005 2952
     // special fields
3006 2953
     pub unknown_fields: ::protobuf::UnknownFields,
3007 2954
     pub cached_size: ::protobuf::CachedSize,
@@ -3091,7 +3038,7 @@ impl Way {
3091 3038
 
3092 3039
 
3093 3040
     pub fn get_info(&self) -> &Info {
3094
-        self.info.as_ref().unwrap_or_else(|| Info::default_instance())
3041
+        self.info.as_ref().unwrap_or_else(|| <Info as ::protobuf::Message>::default_instance())
3095 3042
     }
3096 3043
     pub fn clear_info(&mut self) {
3097 3044
         self.info.clear();
@@ -3270,7 +3217,7 @@ impl ::protobuf::Message for Way {
3270 3217
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
3271 3218
         self as &mut dyn (::std::any::Any)
3272 3219
     }
3273
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
3220
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
3274 3221
         self
3275 3222
     }
3276 3223
 
@@ -3283,13 +3230,8 @@ impl ::protobuf::Message for Way {
3283 3230
     }
3284 3231
 
3285 3232
     fn default_instance() -> &'static Way {
3286
-        static mut instance: ::protobuf::lazy::Lazy<Way> = ::protobuf::lazy::Lazy {
3287
-            lock: ::protobuf::lazy::ONCE_INIT,
3288
-            ptr: 0 as *const Way,
3289
-        };
3290
-        unsafe {
3291
-            instance.get(Way::new)
3292
-        }
3233
+        static instance: ::protobuf::rt::LazyV2<Way> = ::protobuf::rt::LazyV2::INIT;
3234
+        instance.get(Way::new)
3293 3235
     }
3294 3236
 }
3295 3237
 
@@ -3305,8 +3247,8 @@ impl ::protobuf::Clear for Way {
3305 3247
 }
3306 3248
 
3307 3249
 impl ::protobuf::reflect::ProtobufValue for Way {
3308
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
3309
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
3250
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
3251
+        ::protobuf::reflect::ReflectValueRef::Message(self)
3310 3252
     }
3311 3253
 }
3312 3254
 
@@ -3314,12 +3256,12 @@ impl ::protobuf::reflect::ProtobufValue for Way {
3314 3256
 pub struct Relation {
3315 3257
     // message fields
3316 3258
     id: ::std::option::Option<i64>,
3317
-    keys: ::std::vec::Vec<u32>,
3318
-    vals: ::std::vec::Vec<u32>,
3319
-    info: ::protobuf::SingularPtrField<Info>,
3320
-    roles_sid: ::std::vec::Vec<i32>,
3321
-    memids: ::std::vec::Vec<i64>,
3322
-    types: ::std::vec::Vec<Relation_MemberType>,
3259
+    pub keys: ::std::vec::Vec<u32>,
3260
+    pub vals: ::std::vec::Vec<u32>,
3261
+    pub info: ::protobuf::SingularPtrField<Info>,
3262
+    pub roles_sid: ::std::vec::Vec<i32>,
3263
+    pub memids: ::std::vec::Vec<i64>,
3264
+    pub types: ::std::vec::Vec<Relation_MemberType>,
3323 3265
     // special fields
3324 3266
     pub unknown_fields: ::protobuf::UnknownFields,
3325 3267
     pub cached_size: ::protobuf::CachedSize,
@@ -3409,7 +3351,7 @@ impl Relation {
3409 3351
 
3410 3352
 
3411 3353
     pub fn get_info(&self) -> &Info {
3412
-        self.info.as_ref().unwrap_or_else(|| Info::default_instance())
3354
+        self.info.as_ref().unwrap_or_else(|| <Info as ::protobuf::Message>::default_instance())
3413 3355
     }
3414 3356
     pub fn clear_info(&mut self) {
3415 3357
         self.info.clear();
@@ -3641,7 +3583,7 @@ impl ::protobuf::Message for Relation {
3641 3583
             // TODO: Data size is computed again, it should be cached
3642 3584
             os.write_raw_varint32(::protobuf::rt::vec_packed_enum_data_size(&self.types))?;
3643 3585
             for v in &self.types {
3644
-                os.write_enum_no_tag(v.value())?;
3586
+                os.write_enum_no_tag(::protobuf::ProtobufEnum::value(v))?;
3645 3587
             };
3646 3588
         }
3647 3589
         os.write_unknown_fields(self.get_unknown_fields())?;
@@ -3666,7 +3608,7 @@ impl ::protobuf::Message for Relation {
3666 3608
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
3667 3609
         self as &mut dyn (::std::any::Any)
3668 3610
     }
3669
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
3611
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
3670 3612
         self
3671 3613
     }
3672 3614
 
@@ -3679,13 +3621,8 @@ impl ::protobuf::Message for Relation {
3679 3621
     }
3680 3622
 
3681 3623
     fn default_instance() -> &'static Relation {
3682
-        static mut instance: ::protobuf::lazy::Lazy<Relation> = ::protobuf::lazy::Lazy {
3683
-            lock: ::protobuf::lazy::ONCE_INIT,
3684
-            ptr: 0 as *const Relation,
3685
-        };
3686
-        unsafe {
3687
-            instance.get(Relation::new)
3688
-        }
3624
+        static instance: ::protobuf::rt::LazyV2<Relation> = ::protobuf::rt::LazyV2::INIT;
3625
+        instance.get(Relation::new)
3689 3626
     }
3690 3627
 }
3691 3628
 
@@ -3703,8 +3640,8 @@ impl ::protobuf::Clear for Relation {
3703 3640
 }
3704 3641
 
3705 3642
 impl ::protobuf::reflect::ProtobufValue for Relation {
3706
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
3707
-        ::protobuf::reflect::ProtobufValueRef::Message(self)
3643
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
3644
+        ::protobuf::reflect::ReflectValueRef::Message(self)
3708 3645
     }
3709 3646
 }
3710 3647
 
@@ -3749,7 +3686,7 @@ impl ::std::default::Default for Relation_MemberType {
3749 3686
 }
3750 3687
 
3751 3688
 impl ::protobuf::reflect::ProtobufValue for Relation_MemberType {
3752
-    fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
3753
-        ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
3689
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
3690
+        ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self))
3754 3691
     }
3755 3692
 }

+ 3
- 3
tests/read.rs Zobrazit soubor

@@ -81,9 +81,9 @@ fn check_primitive_block_content(block: &PrimitiveBlock) {
81 81
         assert_eq!(dense_nodes[1].id, 106);
82 82
         assert_eq!(dense_nodes[2].id, 108);
83 83
 
84
-        assert_eq!(dense_nodes[0].uid, 17);
85
-        assert_eq!(dense_nodes[1].uid, 17);
86
-        assert_eq!(dense_nodes[2].uid, 17);
84
+        assert_eq!(dense_nodes[0].info().map(|x| x.uid()), Some(17));
85
+        assert_eq!(dense_nodes[1].info().map(|x| x.uid()), Some(17));
86
+        assert_eq!(dense_nodes[2].info().map(|x| x.uid()), Some(17));
87 87
     }
88 88
 
89 89
     {