Browse Source

Update to protobuf 1.6, regenerate files

Johannes Hofmann 7 years ago
parent
commit
5e9b4516df
5 changed files with 166 additions and 780 deletions
  1. 1
    1
      Cargo.toml
  2. 2
    2
      src/blob.rs
  3. 23
    97
      src/proto/fileformat.rs
  4. 136
    676
      src/proto/osmformat.rs
  5. 4
    4
      src/util.rs

+ 1
- 1
Cargo.toml View File

21
 system-libz = ["flate2"]
21
 system-libz = ["flate2"]
22
 
22
 
23
 [dependencies]
23
 [dependencies]
24
-protobuf = "1.4"
24
+protobuf = "1.6"
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"

+ 2
- 2
src/blob.rs View File

218
 
218
 
219
 #[cfg(feature = "system-libz")]
219
 #[cfg(feature = "system-libz")]
220
 pub(crate) fn decode_blob<T>(blob: &fileformat::Blob) -> Result<T>
220
 pub(crate) fn decode_blob<T>(blob: &fileformat::Blob) -> Result<T>
221
-    where T: protobuf::Message + protobuf::MessageStatic {
221
+    where T: protobuf::Message {
222
     if blob.has_raw() {
222
     if blob.has_raw() {
223
         let size = blob.get_raw().len() as u64;
223
         let size = blob.get_raw().len() as u64;
224
         if size < MAX_BLOB_MESSAGE_SIZE {
224
         if size < MAX_BLOB_MESSAGE_SIZE {
237
 
237
 
238
 #[cfg(not(feature = "system-libz"))]
238
 #[cfg(not(feature = "system-libz"))]
239
 pub(crate) fn decode_blob<T>(blob: &fileformat::Blob) -> Result<T>
239
 pub(crate) fn decode_blob<T>(blob: &fileformat::Blob) -> Result<T>
240
-    where T: protobuf::Message + protobuf::MessageStatic {
240
+    where T: protobuf::Message {
241
     if blob.has_raw() {
241
     if blob.has_raw() {
242
         let size = blob.get_raw().len() as u64;
242
         let size = blob.get_raw().len() as u64;
243
         if size < MAX_BLOB_MESSAGE_SIZE {
243
         if size < MAX_BLOB_MESSAGE_SIZE {

+ 23
- 97
src/proto/fileformat.rs View File

1
-// This file is generated. Do not edit
1
+// This file is generated by rust-protobuf 1.6.0. Do not edit
2
 // @generated
2
 // @generated
3
 
3
 
4
 // https://github.com/Manishearth/rust-clippy/issues/702
4
 // https://github.com/Manishearth/rust-clippy/issues/702
34
     cached_size: ::protobuf::CachedSize,
34
     cached_size: ::protobuf::CachedSize,
35
 }
35
 }
36
 
36
 
37
-// see codegen.rs for the explanation why impl Sync explicitly
38
-unsafe impl ::std::marker::Sync for Blob {}
39
-
40
 impl Blob {
37
 impl Blob {
41
     pub fn new() -> Blob {
38
     pub fn new() -> Blob {
42
         ::std::default::Default::default()
39
         ::std::default::Default::default()
43
     }
40
     }
44
 
41
 
45
-    pub fn default_instance() -> &'static Blob {
46
-        static mut instance: ::protobuf::lazy::Lazy<Blob> = ::protobuf::lazy::Lazy {
47
-            lock: ::protobuf::lazy::ONCE_INIT,
48
-            ptr: 0 as *const Blob,
49
-        };
50
-        unsafe {
51
-            instance.get(Blob::new)
52
-        }
53
-    }
54
-
55
     // optional bytes raw = 1;
42
     // optional bytes raw = 1;
56
 
43
 
57
     pub fn clear_raw(&mut self) {
44
     pub fn clear_raw(&mut self) {
88
         }
75
         }
89
     }
76
     }
90
 
77
 
91
-    fn get_raw_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
92
-        &self.raw
93
-    }
94
-
95
-    fn mut_raw_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
96
-        &mut self.raw
97
-    }
98
-
99
     // optional int32 raw_size = 2;
78
     // optional int32 raw_size = 2;
100
 
79
 
101
     pub fn clear_raw_size(&mut self) {
80
     pub fn clear_raw_size(&mut self) {
115
         self.raw_size.unwrap_or(0)
94
         self.raw_size.unwrap_or(0)
116
     }
95
     }
117
 
96
 
118
-    fn get_raw_size_for_reflect(&self) -> &::std::option::Option<i32> {
119
-        &self.raw_size
120
-    }
121
-
122
-    fn mut_raw_size_for_reflect(&mut self) -> &mut ::std::option::Option<i32> {
123
-        &mut self.raw_size
124
-    }
125
-
126
     // optional bytes zlib_data = 3;
97
     // optional bytes zlib_data = 3;
127
 
98
 
128
     pub fn clear_zlib_data(&mut self) {
99
     pub fn clear_zlib_data(&mut self) {
159
         }
130
         }
160
     }
131
     }
161
 
132
 
162
-    fn get_zlib_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
163
-        &self.zlib_data
164
-    }
165
-
166
-    fn mut_zlib_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
167
-        &mut self.zlib_data
168
-    }
169
-
170
     // optional bytes lzma_data = 4;
133
     // optional bytes lzma_data = 4;
171
 
134
 
172
     pub fn clear_lzma_data(&mut self) {
135
     pub fn clear_lzma_data(&mut self) {
203
         }
166
         }
204
     }
167
     }
205
 
168
 
206
-    fn get_lzma_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
207
-        &self.lzma_data
208
-    }
209
-
210
-    fn mut_lzma_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
211
-        &mut self.lzma_data
212
-    }
213
-
214
     // optional bytes OBSOLETE_bzip2_data = 5;
169
     // optional bytes OBSOLETE_bzip2_data = 5;
215
 
170
 
216
     pub fn clear_OBSOLETE_bzip2_data(&mut self) {
171
     pub fn clear_OBSOLETE_bzip2_data(&mut self) {
246
             None => &[],
201
             None => &[],
247
         }
202
         }
248
     }
203
     }
249
-
250
-    fn get_OBSOLETE_bzip2_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
251
-        &self.OBSOLETE_bzip2_data
252
-    }
253
-
254
-    fn mut_OBSOLETE_bzip2_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
255
-        &mut self.OBSOLETE_bzip2_data
256
-    }
257
 }
204
 }
258
 
205
 
259
 impl ::protobuf::Message for Blob {
206
 impl ::protobuf::Message for Blob {
359
     }
306
     }
360
 
307
 
361
     fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
308
     fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
362
-        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
309
+        Self::descriptor_static()
363
     }
310
     }
364
-}
365
 
311
 
366
-impl ::protobuf::MessageStatic for Blob {
367
     fn new() -> Blob {
312
     fn new() -> Blob {
368
         Blob::new()
313
         Blob::new()
369
     }
314
     }
315
+
316
+    fn default_instance() -> &'static Blob {
317
+        static mut instance: ::protobuf::lazy::Lazy<Blob> = ::protobuf::lazy::Lazy {
318
+            lock: ::protobuf::lazy::ONCE_INIT,
319
+            ptr: 0 as *const Blob,
320
+        };
321
+        unsafe {
322
+            instance.get(Blob::new)
323
+        }
324
+    }
370
 }
325
 }
371
 
326
 
372
 impl ::protobuf::Clear for Blob {
327
 impl ::protobuf::Clear for Blob {
397
     cached_size: ::protobuf::CachedSize,
352
     cached_size: ::protobuf::CachedSize,
398
 }
353
 }
399
 
354
 
400
-// see codegen.rs for the explanation why impl Sync explicitly
401
-unsafe impl ::std::marker::Sync for BlobHeader {}
402
-
403
 impl BlobHeader {
355
 impl BlobHeader {
404
     pub fn new() -> BlobHeader {
356
     pub fn new() -> BlobHeader {
405
         ::std::default::Default::default()
357
         ::std::default::Default::default()
406
     }
358
     }
407
 
359
 
408
-    pub fn default_instance() -> &'static BlobHeader {
409
-        static mut instance: ::protobuf::lazy::Lazy<BlobHeader> = ::protobuf::lazy::Lazy {
410
-            lock: ::protobuf::lazy::ONCE_INIT,
411
-            ptr: 0 as *const BlobHeader,
412
-        };
413
-        unsafe {
414
-            instance.get(BlobHeader::new)
415
-        }
416
-    }
417
-
418
     // required string type = 1;
360
     // required string type = 1;
419
 
361
 
420
     pub fn clear_field_type(&mut self) {
362
     pub fn clear_field_type(&mut self) {
451
         }
393
         }
452
     }
394
     }
453
 
395
 
454
-    fn get_field_type_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> {
455
-        &self.field_type
456
-    }
457
-
458
-    fn mut_field_type_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> {
459
-        &mut self.field_type
460
-    }
461
-
462
     // optional bytes indexdata = 2;
396
     // optional bytes indexdata = 2;
463
 
397
 
464
     pub fn clear_indexdata(&mut self) {
398
     pub fn clear_indexdata(&mut self) {
495
         }
429
         }
496
     }
430
     }
497
 
431
 
498
-    fn get_indexdata_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec<u8>> {
499
-        &self.indexdata
500
-    }
501
-
502
-    fn mut_indexdata_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec<u8>> {
503
-        &mut self.indexdata
504
-    }
505
-
506
     // required int32 datasize = 3;
432
     // required int32 datasize = 3;
507
 
433
 
508
     pub fn clear_datasize(&mut self) {
434
     pub fn clear_datasize(&mut self) {
521
     pub fn get_datasize(&self) -> i32 {
447
     pub fn get_datasize(&self) -> i32 {
522
         self.datasize.unwrap_or(0)
448
         self.datasize.unwrap_or(0)
523
     }
449
     }
524
-
525
-    fn get_datasize_for_reflect(&self) -> &::std::option::Option<i32> {
526
-        &self.datasize
527
-    }
528
-
529
-    fn mut_datasize_for_reflect(&mut self) -> &mut ::std::option::Option<i32> {
530
-        &mut self.datasize
531
-    }
532
 }
450
 }
533
 
451
 
534
 impl ::protobuf::Message for BlobHeader {
452
 impl ::protobuf::Message for BlobHeader {
622
     }
540
     }
623
 
541
 
624
     fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
542
     fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
625
-        ::protobuf::MessageStatic::descriptor_static(None::<Self>)
543
+        Self::descriptor_static()
626
     }
544
     }
627
-}
628
 
545
 
629
-impl ::protobuf::MessageStatic for BlobHeader {
630
     fn new() -> BlobHeader {
546
     fn new() -> BlobHeader {
631
         BlobHeader::new()
547
         BlobHeader::new()
632
     }
548
     }
549
+
550
+    fn default_instance() -> &'static BlobHeader {
551
+        static mut instance: ::protobuf::lazy::Lazy<BlobHeader> = ::protobuf::lazy::Lazy {
552
+            lock: ::protobuf::lazy::ONCE_INIT,
553
+            ptr: 0 as *const BlobHeader,
554
+        };
555
+        unsafe {
556
+            instance.get(BlobHeader::new)
557
+        }
558
+    }
633
 }
559
 }
634
 
560
 
635
 impl ::protobuf::Clear for BlobHeader {
561
 impl ::protobuf::Clear for BlobHeader {

+ 136
- 676
src/proto/osmformat.rs
File diff suppressed because it is too large
View File


+ 4
- 4
src/util.rs View File

3
 
3
 
4
 
4
 
5
 pub(crate) fn parse_message_from_bytes<M>(bytes: &[u8]) -> Result<M>
5
 pub(crate) fn parse_message_from_bytes<M>(bytes: &[u8]) -> Result<M>
6
-    where M: ::protobuf::Message + ::protobuf::MessageStatic
6
+    where M: ::protobuf::Message
7
 {
7
 {
8
     let mut stream = ::protobuf::CodedInputStream::from_bytes(bytes);
8
     let mut stream = ::protobuf::CodedInputStream::from_bytes(bytes);
9
-    let mut message: M = ::protobuf::MessageStatic::new();
9
+    let mut message: M = ::protobuf::Message::new();
10
     message.merge_from(&mut stream)?;
10
     message.merge_from(&mut stream)?;
11
 
11
 
12
     if message.is_initialized() {
12
     if message.is_initialized() {
18
 
18
 
19
 pub(crate) fn parse_message_from_reader<R, M>(reader: &mut R) -> Result<M>
19
 pub(crate) fn parse_message_from_reader<R, M>(reader: &mut R) -> Result<M>
20
     where R: Read,
20
     where R: Read,
21
-          M: ::protobuf::Message + ::protobuf::MessageStatic,
21
+          M: ::protobuf::Message,
22
 {
22
 {
23
     let mut stream = ::protobuf::CodedInputStream::new(reader);
23
     let mut stream = ::protobuf::CodedInputStream::new(reader);
24
-    let mut message: M = ::protobuf::MessageStatic::new();
24
+    let mut message: M = ::protobuf::Message::new();
25
     message.merge_from(&mut stream)?;
25
     message.merge_from(&mut stream)?;
26
 
26
 
27
     stream.check_eof()?;
27
     stream.check_eof()?;