13 커밋

작성자 SHA1 메시지 날짜
  Johannes Hofmann 9655cbd601 Release 0.2.2 5 년 전
  Johannes Hofmann ac05a602ba Regenerate *.rs files in `src/proto/` 5 년 전
  Johannes Hofmann 0b1a5c3f63 Update CI config to actually fail on error 5 년 전
  Johannes Hofmann 7bd6a91083 Release 0.2.1 5 년 전
  Johannes Hofmann df3d8b2a21 README, lib.rs: Use ? operator in documentation 5 년 전
  Johannes Hofmann d3170b4c46 Fix deprecation warnings of protoc_rust 5 년 전
  Johannes Hofmann 5b150dc338 Regenerate *.rs files in `src/proto/` 5 년 전
  Johannes Hofmann c7b110a9e8 CI: Bump minimum supported Rust version to 1.44.1 5 년 전
  Johannes Hofmann 6869e41d62 Release 0.2.0 5 년 전
  Johannes Hofmann 055192e9c4 dense.rs: Fix minor typo 5 년 전
  Johannes Hofmann a990538123 Merge branch 'bugfix/dense_node_iterator' of https://github.com/nikmikov/osmpbf into nikmikov-bugfix/dense_node_iterator 5 년 전
  Johannes Hofmann 3dfd10b765 Regenerate *.rs files in `src/proto/` 5 년 전
  Nikolay Mikov ee82ea359b Fix DenseNodeIter when dense node info is empty 5 년 전
10개의 변경된 파일296개의 추가작업 그리고 327개의 파일을 삭제
  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 파일 보기

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

+ 4
- 5
.travis.yml 파일 보기

4
   - stable
4
   - stable
5
   - beta
5
   - beta
6
   - nightly
6
   - nightly
7
-  - 1.36.0
7
+  - 1.44.1
8
 script:
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
 env:
12
 env:
14
   - RUSTFLAGS="-D warnings"
13
   - RUSTFLAGS="-D warnings"

+ 2
- 2
Cargo.toml 파일 보기

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

+ 28
- 34
README.md 파일 보기

16
 
16
 
17
 ```toml
17
 ```toml
18
 [dependencies]
18
 [dependencies]
19
-osmpbf = "0.1"
19
+osmpbf = "0.2"
20
 ```
20
 ```
21
 
21
 
22
 and if you're using Rust 2015, add this line to the crate root:
22
 and if you're using Rust 2015, add this line to the crate root:
28
 Here's a simple example that counts all the ways in a file:
28
 Here's a simple example that counts all the ways in a file:
29
 
29
 
30
 ```rust
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
 In this second example, we also count the ways but make use of all cores by
46
 In this second example, we also count the ways but make use of all cores by
51
 decoding the file in parallel:
47
 decoding the file in parallel:
52
 
48
 
53
 ```rust
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
 ## The PBF format
69
 ## The PBF format

+ 5
- 8
build_proto.rs 파일 보기

14
         println!("cargo:rerun-if-changed={}", path);
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 파일 보기

14
     /// The node id. It should be unique between nodes and might be negative to indicate
14
     /// The node id. It should be unique between nodes and might be negative to indicate
15
     /// that the element has not yet been uploaded to a server.
15
     /// that the element has not yet been uploaded to a server.
16
     pub id: i64,
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
     lat: i64,
17
     lat: i64,
26
     lon: i64,
18
     lon: i64,
27
     keys_vals_indices: &'a [i32],
19
     keys_vals_indices: &'a [i32],
20
+    info: Option<DenseNodeInfo<'a>>,
28
 }
21
 }
29
 
22
 
30
 impl<'a> DenseNode<'a> {
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
     /// Returns the latitude coordinate in degrees.
29
     /// Returns the latitude coordinate in degrees.
63
         (self.nano_lon() / 100) as i32
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
     /// Returns an iterator over the tags of this node (See [OSM wiki](http://wiki.openstreetmap.org/wiki/Tags)).
59
     /// Returns an iterator over the tags of this node (See [OSM wiki](http://wiki.openstreetmap.org/wiki/Tags)).
72
     pub fn tags(&self) -> DenseTagIter<'a> {
60
     pub fn tags(&self) -> DenseTagIter<'a> {
73
         DenseTagIter {
61
         DenseTagIter {
91
 #[derive(Clone, Debug)]
79
 #[derive(Clone, Debug)]
92
 pub struct DenseNodeIter<'a> {
80
 pub struct DenseNodeIter<'a> {
93
     block: &'a osmformat::PrimitiveBlock,
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
     dlats: std::slice::Iter<'a, i64>, // deltas
84
     dlats: std::slice::Iter<'a, i64>, // deltas
106
     clat: i64,
85
     clat: i64,
107
     dlons: std::slice::Iter<'a, i64>, // deltas
86
     dlons: std::slice::Iter<'a, i64>, // deltas
108
     clon: i64,
87
     clon: i64,
109
     keys_vals_slice: &'a [i32],
88
     keys_vals_slice: &'a [i32],
110
     keys_vals_index: usize,
89
     keys_vals_index: usize,
90
+    info_iter: Option<DenseNodeInfoIter<'a>>,
111
 }
91
 }
112
 
92
 
113
 impl<'a> DenseNodeIter<'a> {
93
 impl<'a> DenseNodeIter<'a> {
115
         block: &'a osmformat::PrimitiveBlock,
95
         block: &'a osmformat::PrimitiveBlock,
116
         osmdense: &'a osmformat::DenseNodes,
96
         osmdense: &'a osmformat::DenseNodes,
117
     ) -> DenseNodeIter<'a> {
97
     ) -> DenseNodeIter<'a> {
118
-        let info = osmdense.get_denseinfo();
98
+        let info_iter = Some(DenseNodeInfoIter::new(block, osmdense.get_denseinfo()));
119
         DenseNodeIter {
99
         DenseNodeIter {
120
             block,
100
             block,
121
             dids: osmdense.get_id().iter(),
101
             dids: osmdense.get_id().iter(),
122
             cid: 0,
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
             dlats: osmdense.get_lat().iter(),
103
             dlats: osmdense.get_lat().iter(),
133
             clat: 0,
104
             clat: 0,
134
             dlons: osmdense.get_lon().iter(),
105
             dlons: osmdense.get_lon().iter(),
135
             clon: 0,
106
             clon: 0,
136
             keys_vals_slice: osmdense.get_keys_vals(),
107
             keys_vals_slice: osmdense.get_keys_vals(),
137
             keys_vals_index: 0,
108
             keys_vals_index: 0,
109
+            info_iter,
138
         }
110
         }
139
     }
111
     }
140
 
112
 
143
             block,
115
             block,
144
             dids: [].iter(),
116
             dids: [].iter(),
145
             cid: 0,
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
             dlats: [].iter(),
118
             dlats: [].iter(),
156
             clat: 0,
119
             clat: 0,
157
             dlons: [].iter(),
120
             dlons: [].iter(),
158
             clon: 0,
121
             clon: 0,
159
             keys_vals_slice: &[],
122
             keys_vals_slice: &[],
160
             keys_vals_index: 0,
123
             keys_vals_index: 0,
124
+            info_iter: None,
161
         }
125
         }
162
     }
126
     }
163
 }
127
 }
168
     fn next(&mut self) -> Option<Self::Item> {
132
     fn next(&mut self) -> Option<Self::Item> {
169
         match (
133
         match (
170
             self.dids.next(),
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
             self.dlats.next(),
135
             self.dlats.next(),
177
             self.dlons.next(),
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
                 self.cid += *did;
140
                 self.cid += *did;
190
-                self.ctimestamp += *dtimestamp;
191
-                self.cchangeset += *dchangeset;
192
-                self.cuid += *duid;
193
-                self.cuser_sid += *duser_sid;
194
                 self.clat += *dlat;
141
                 self.clat += *dlat;
195
                 self.clon += *dlon;
142
                 self.clon += *dlon;
196
 
143
 
209
                 Some(DenseNode {
156
                 Some(DenseNode {
210
                     block: self.block,
157
                     block: self.block,
211
                     id: self.cid,
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
                     lat: self.clat,
159
                     lat: self.clat,
218
                     lon: self.clon,
160
                     lon: self.clon,
219
                     keys_vals_indices: &self.keys_vals_slice[start_index..end_index],
161
                     keys_vals_indices: &self.keys_vals_slice[start_index..end_index],
162
+                    info,
220
                 })
163
                 })
221
             }
164
             }
222
             _ => None,
165
             _ => None,
230
 
173
 
231
 impl<'a> ExactSizeIterator for DenseNodeIter<'a> {}
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
 /// An iterator over the tags in a dense node.
284
 /// An iterator over the tags in a dense node.
234
 #[derive(Clone, Debug)]
285
 #[derive(Clone, Debug)]
235
 pub struct DenseTagIter<'a> {
286
 pub struct DenseTagIter<'a> {

+ 9
- 5
src/lib.rs 파일 보기

7
 
7
 
8
 ```toml
8
 ```toml
9
 [dependencies]
9
 [dependencies]
10
-osmpbf = "0.1"
10
+osmpbf = "0.2"
11
 ```
11
 ```
12
 
12
 
13
 and if you're using Rust 2015, add this line to the crate root:
13
 and if you're using Rust 2015, add this line to the crate root:
24
 ```rust
24
 ```rust
25
 use osmpbf::{ElementReader, Element};
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
 let mut ways = 0_u64;
28
 let mut ways = 0_u64;
29
 
29
 
30
 // Increment the counter by one for each way.
30
 // Increment the counter by one for each way.
32
     if let Element::Way(_) = element {
32
     if let Element::Way(_) = element {
33
         ways += 1;
33
         ways += 1;
34
     }
34
     }
35
-}).unwrap();
35
+})?;
36
 
36
 
37
 println!("Number of ways: {}", ways);
37
 println!("Number of ways: {}", ways);
38
+# assert_eq!(ways, 1);
39
+# Ok::<(), std::io::Error>(())
38
 ```
40
 ```
39
 
41
 
40
 ## Example: Count ways in parallel
42
 ## Example: Count ways in parallel
45
 ```rust
47
 ```rust
46
 use osmpbf::{ElementReader, Element};
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
 // Count the ways
52
 // Count the ways
51
 let ways = reader.par_map_reduce(
53
 let ways = reader.par_map_reduce(
57
     },
59
     },
58
     || 0_u64,      // Zero is the identity value for addition
60
     || 0_u64,      // Zero is the identity value for addition
59
     |a, b| a + b   // Sum the partial results
61
     |a, b| a + b   // Sum the partial results
60
-).unwrap();
62
+)?;
61
 
63
 
62
 println!("Number of ways: {}", ways);
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 파일 보기

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
 // @generated
2
 // @generated
3
 
3
 
4
 // https://github.com/rust-lang/rust-clippy/issues/702
4
 // https://github.com/rust-lang/rust-clippy/issues/702
5
 #![allow(unknown_lints)]
5
 #![allow(unknown_lints)]
6
 #![allow(clippy::all)]
6
 #![allow(clippy::all)]
7
 
7
 
8
-#![cfg_attr(rustfmt, rustfmt_skip)]
8
+#![allow(unused_attributes)]
9
+#![rustfmt::skip]
9
 
10
 
10
 #![allow(box_pointers)]
11
 #![allow(box_pointers)]
11
 #![allow(dead_code)]
12
 #![allow(dead_code)]
14
 #![allow(non_snake_case)]
15
 #![allow(non_snake_case)]
15
 #![allow(non_upper_case_globals)]
16
 #![allow(non_upper_case_globals)]
16
 #![allow(trivial_casts)]
17
 #![allow(trivial_casts)]
17
-#![allow(unsafe_code)]
18
 #![allow(unused_imports)]
18
 #![allow(unused_imports)]
19
 #![allow(unused_results)]
19
 #![allow(unused_results)]
20
 //! Generated file from `src/proto/fileformat.proto`
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
 /// Generated files are compatible only with the same version
22
 /// Generated files are compatible only with the same version
26
 /// of protobuf runtime.
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
 #[derive(PartialEq,Clone,Default,Debug)]
26
 #[derive(PartialEq,Clone,Default,Debug)]
30
 pub struct Blob {
27
 pub struct Blob {
312
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
309
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
313
         self as &mut dyn (::std::any::Any)
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
         self
313
         self
317
     }
314
     }
318
 
315
 
325
     }
322
     }
326
 
323
 
327
     fn default_instance() -> &'static Blob {
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
 }
339
 }
348
 
340
 
349
 impl ::protobuf::reflect::ProtobufValue for Blob {
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
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
544
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
553
         self as &mut dyn (::std::any::Any)
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
         self
548
         self
557
     }
549
     }
558
 
550
 
565
     }
557
     }
566
 
558
 
567
     fn default_instance() -> &'static BlobHeader {
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
 }
572
 }
586
 
573
 
587
 impl ::protobuf::reflect::ProtobufValue for BlobHeader {
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 파일 보기

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
 // @generated
2
 // @generated
3
 
3
 
4
 // https://github.com/rust-lang/rust-clippy/issues/702
4
 // https://github.com/rust-lang/rust-clippy/issues/702
5
 #![allow(unknown_lints)]
5
 #![allow(unknown_lints)]
6
 #![allow(clippy::all)]
6
 #![allow(clippy::all)]
7
 
7
 
8
-#![cfg_attr(rustfmt, rustfmt_skip)]
8
+#![allow(unused_attributes)]
9
+#![rustfmt::skip]
9
 
10
 
10
 #![allow(box_pointers)]
11
 #![allow(box_pointers)]
11
 #![allow(dead_code)]
12
 #![allow(dead_code)]
14
 #![allow(non_snake_case)]
15
 #![allow(non_snake_case)]
15
 #![allow(non_upper_case_globals)]
16
 #![allow(non_upper_case_globals)]
16
 #![allow(trivial_casts)]
17
 #![allow(trivial_casts)]
17
-#![allow(unsafe_code)]
18
 #![allow(unused_imports)]
18
 #![allow(unused_imports)]
19
 #![allow(unused_results)]
19
 #![allow(unused_results)]
20
 //! Generated file from `src/proto/osmformat.proto`
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
 /// Generated files are compatible only with the same version
22
 /// Generated files are compatible only with the same version
26
 /// of protobuf runtime.
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
 #[derive(PartialEq,Clone,Default,Debug)]
26
 #[derive(PartialEq,Clone,Default,Debug)]
30
 pub struct HeaderBlock {
27
 pub struct HeaderBlock {
31
     // message fields
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
     writingprogram: ::protobuf::SingularField<::std::string::String>,
32
     writingprogram: ::protobuf::SingularField<::std::string::String>,
36
     source: ::protobuf::SingularField<::std::string::String>,
33
     source: ::protobuf::SingularField<::std::string::String>,
37
     osmosis_replication_timestamp: ::std::option::Option<i64>,
34
     osmosis_replication_timestamp: ::std::option::Option<i64>,
57
 
54
 
58
 
55
 
59
     pub fn get_bbox(&self) -> &HeaderBBox {
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
     pub fn clear_bbox(&mut self) {
59
     pub fn clear_bbox(&mut self) {
63
         self.bbox.clear();
60
         self.bbox.clear();
420
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
417
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
421
         self as &mut dyn (::std::any::Any)
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
         self
421
         self
425
     }
422
     }
426
 
423
 
433
     }
430
     }
434
 
431
 
435
     fn default_instance() -> &'static HeaderBlock {
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
 }
450
 }
459
 
451
 
460
 impl ::protobuf::reflect::ProtobufValue for HeaderBlock {
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
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
668
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
677
         self as &mut dyn (::std::any::Any)
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
         self
672
         self
681
     }
673
     }
682
 
674
 
689
     }
681
     }
690
 
682
 
691
     fn default_instance() -> &'static HeaderBBox {
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
 }
697
 }
711
 
698
 
712
 impl ::protobuf::reflect::ProtobufValue for HeaderBBox {
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
 #[derive(PartialEq,Clone,Default,Debug)]
705
 #[derive(PartialEq,Clone,Default,Debug)]
719
 pub struct PrimitiveBlock {
706
 pub struct PrimitiveBlock {
720
     // message fields
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
     granularity: ::std::option::Option<i32>,
710
     granularity: ::std::option::Option<i32>,
724
     lat_offset: ::std::option::Option<i64>,
711
     lat_offset: ::std::option::Option<i64>,
725
     lon_offset: ::std::option::Option<i64>,
712
     lon_offset: ::std::option::Option<i64>,
744
 
731
 
745
 
732
 
746
     pub fn get_stringtable(&self) -> &StringTable {
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
     pub fn clear_stringtable(&mut self) {
736
     pub fn clear_stringtable(&mut self) {
750
         self.stringtable.clear();
737
         self.stringtable.clear();
1013
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1000
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1014
         self as &mut dyn (::std::any::Any)
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
         self
1004
         self
1018
     }
1005
     }
1019
 
1006
 
1026
     }
1013
     }
1027
 
1014
 
1028
     fn default_instance() -> &'static PrimitiveBlock {
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
 }
1031
 }
1050
 
1032
 
1051
 impl ::protobuf::reflect::ProtobufValue for PrimitiveBlock {
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
 #[derive(PartialEq,Clone,Default,Debug)]
1039
 #[derive(PartialEq,Clone,Default,Debug)]
1058
 pub struct PrimitiveGroup {
1040
 pub struct PrimitiveGroup {
1059
     // message fields
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
     // special fields
1047
     // special fields
1066
     pub unknown_fields: ::protobuf::UnknownFields,
1048
     pub unknown_fields: ::protobuf::UnknownFields,
1067
     pub cached_size: ::protobuf::CachedSize,
1049
     pub cached_size: ::protobuf::CachedSize,
1107
 
1089
 
1108
 
1090
 
1109
     pub fn get_dense(&self) -> &DenseNodes {
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
     pub fn clear_dense(&mut self) {
1094
     pub fn clear_dense(&mut self) {
1113
         self.dense.clear();
1095
         self.dense.clear();
1346
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1328
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1347
         self as &mut dyn (::std::any::Any)
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
         self
1332
         self
1351
     }
1333
     }
1352
 
1334
 
1359
     }
1341
     }
1360
 
1342
 
1361
     fn default_instance() -> &'static PrimitiveGroup {
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
 }
1358
 }
1382
 
1359
 
1383
 impl ::protobuf::reflect::ProtobufValue for PrimitiveGroup {
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
 #[derive(PartialEq,Clone,Default,Debug)]
1366
 #[derive(PartialEq,Clone,Default,Debug)]
1390
 pub struct StringTable {
1367
 pub struct StringTable {
1391
     // message fields
1368
     // message fields
1392
-    s: ::protobuf::RepeatedField<::std::vec::Vec<u8>>,
1369
+    pub s: ::protobuf::RepeatedField<::std::vec::Vec<u8>>,
1393
     // special fields
1370
     // special fields
1394
     pub unknown_fields: ::protobuf::UnknownFields,
1371
     pub unknown_fields: ::protobuf::UnknownFields,
1395
     pub cached_size: ::protobuf::CachedSize,
1372
     pub cached_size: ::protobuf::CachedSize,
1490
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1467
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1491
         self as &mut dyn (::std::any::Any)
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
         self
1471
         self
1495
     }
1472
     }
1496
 
1473
 
1503
     }
1480
     }
1504
 
1481
 
1505
     fn default_instance() -> &'static StringTable {
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
 }
1493
 }
1522
 
1494
 
1523
 impl ::protobuf::reflect::ProtobufValue for StringTable {
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
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1765
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
1794
         self as &mut dyn (::std::any::Any)
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
         self
1769
         self
1798
     }
1770
     }
1799
 
1771
 
1806
     }
1778
     }
1807
 
1779
 
1808
     fn default_instance() -> &'static Info {
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
 }
1796
 }
1830
 
1797
 
1831
 impl ::protobuf::reflect::ProtobufValue for Info {
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
 #[derive(PartialEq,Clone,Default,Debug)]
1804
 #[derive(PartialEq,Clone,Default,Debug)]
1838
 pub struct DenseInfo {
1805
 pub struct DenseInfo {
1839
     // message fields
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
     // special fields
1813
     // special fields
1847
     pub unknown_fields: ::protobuf::UnknownFields,
1814
     pub unknown_fields: ::protobuf::UnknownFields,
1848
     pub cached_size: ::protobuf::CachedSize,
1815
     pub cached_size: ::protobuf::CachedSize,
2143
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2110
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2144
         self as &mut dyn (::std::any::Any)
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
         self
2114
         self
2148
     }
2115
     }
2149
 
2116
 
2156
     }
2123
     }
2157
 
2124
 
2158
     fn default_instance() -> &'static DenseInfo {
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
 }
2141
 }
2180
 
2142
 
2181
 impl ::protobuf::reflect::ProtobufValue for DenseInfo {
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
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2251
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2290
         self as &mut dyn (::std::any::Any)
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
         self
2255
         self
2294
     }
2256
     }
2295
 
2257
 
2302
     }
2264
     }
2303
 
2265
 
2304
     fn default_instance() -> &'static ChangeSet {
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
 }
2277
 }
2321
 
2278
 
2322
 impl ::protobuf::reflect::ProtobufValue for ChangeSet {
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
 pub struct Node {
2286
 pub struct Node {
2330
     // message fields
2287
     // message fields
2331
     id: ::std::option::Option<i64>,
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
     lat: ::std::option::Option<i64>,
2292
     lat: ::std::option::Option<i64>,
2336
     lon: ::std::option::Option<i64>,
2293
     lon: ::std::option::Option<i64>,
2337
     // special fields
2294
     // special fields
2423
 
2380
 
2424
 
2381
 
2425
     pub fn get_info(&self) -> &Info {
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
     pub fn clear_info(&mut self) {
2385
     pub fn clear_info(&mut self) {
2429
         self.info.clear();
2386
         self.info.clear();
2633
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2590
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2634
         self as &mut dyn (::std::any::Any)
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
         self
2594
         self
2638
     }
2595
     }
2639
 
2596
 
2646
     }
2603
     }
2647
 
2604
 
2648
     fn default_instance() -> &'static Node {
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
 }
2621
 }
2670
 
2622
 
2671
 impl ::protobuf::reflect::ProtobufValue for Node {
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
 #[derive(PartialEq,Clone,Default,Debug)]
2629
 #[derive(PartialEq,Clone,Default,Debug)]
2678
 pub struct DenseNodes {
2630
 pub struct DenseNodes {
2679
     // message fields
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
     // special fields
2637
     // special fields
2686
     pub unknown_fields: ::protobuf::UnknownFields,
2638
     pub unknown_fields: ::protobuf::UnknownFields,
2687
     pub cached_size: ::protobuf::CachedSize,
2639
     pub cached_size: ::protobuf::CachedSize,
2727
 
2679
 
2728
 
2680
 
2729
     pub fn get_denseinfo(&self) -> &DenseInfo {
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
     pub fn clear_denseinfo(&mut self) {
2684
     pub fn clear_denseinfo(&mut self) {
2733
         self.denseinfo.clear();
2685
         self.denseinfo.clear();
2954
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2906
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
2955
         self as &mut dyn (::std::any::Any)
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
         self
2910
         self
2959
     }
2911
     }
2960
 
2912
 
2967
     }
2919
     }
2968
 
2920
 
2969
     fn default_instance() -> &'static DenseNodes {
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
 }
2936
 }
2990
 
2937
 
2991
 impl ::protobuf::reflect::ProtobufValue for DenseNodes {
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
 pub struct Way {
2945
 pub struct Way {
2999
     // message fields
2946
     // message fields
3000
     id: ::std::option::Option<i64>,
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
     // special fields
2952
     // special fields
3006
     pub unknown_fields: ::protobuf::UnknownFields,
2953
     pub unknown_fields: ::protobuf::UnknownFields,
3007
     pub cached_size: ::protobuf::CachedSize,
2954
     pub cached_size: ::protobuf::CachedSize,
3091
 
3038
 
3092
 
3039
 
3093
     pub fn get_info(&self) -> &Info {
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
     pub fn clear_info(&mut self) {
3043
     pub fn clear_info(&mut self) {
3097
         self.info.clear();
3044
         self.info.clear();
3270
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
3217
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
3271
         self as &mut dyn (::std::any::Any)
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
         self
3221
         self
3275
     }
3222
     }
3276
 
3223
 
3283
     }
3230
     }
3284
 
3231
 
3285
     fn default_instance() -> &'static Way {
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
 }
3247
 }
3306
 
3248
 
3307
 impl ::protobuf::reflect::ProtobufValue for Way {
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
 pub struct Relation {
3256
 pub struct Relation {
3315
     // message fields
3257
     // message fields
3316
     id: ::std::option::Option<i64>,
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
     // special fields
3265
     // special fields
3324
     pub unknown_fields: ::protobuf::UnknownFields,
3266
     pub unknown_fields: ::protobuf::UnknownFields,
3325
     pub cached_size: ::protobuf::CachedSize,
3267
     pub cached_size: ::protobuf::CachedSize,
3409
 
3351
 
3410
 
3352
 
3411
     pub fn get_info(&self) -> &Info {
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
     pub fn clear_info(&mut self) {
3356
     pub fn clear_info(&mut self) {
3415
         self.info.clear();
3357
         self.info.clear();
3641
             // TODO: Data size is computed again, it should be cached
3583
             // TODO: Data size is computed again, it should be cached
3642
             os.write_raw_varint32(::protobuf::rt::vec_packed_enum_data_size(&self.types))?;
3584
             os.write_raw_varint32(::protobuf::rt::vec_packed_enum_data_size(&self.types))?;
3643
             for v in &self.types {
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
         os.write_unknown_fields(self.get_unknown_fields())?;
3589
         os.write_unknown_fields(self.get_unknown_fields())?;
3666
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
3608
     fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
3667
         self as &mut dyn (::std::any::Any)
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
         self
3612
         self
3671
     }
3613
     }
3672
 
3614
 
3679
     }
3621
     }
3680
 
3622
 
3681
     fn default_instance() -> &'static Relation {
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
 }
3640
 }
3704
 
3641
 
3705
 impl ::protobuf::reflect::ProtobufValue for Relation {
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
 }
3686
 }
3750
 
3687
 
3751
 impl ::protobuf::reflect::ProtobufValue for Relation_MemberType {
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 파일 보기

81
         assert_eq!(dense_nodes[1].id, 106);
81
         assert_eq!(dense_nodes[1].id, 106);
82
         assert_eq!(dense_nodes[2].id, 108);
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
     {