Quellcode durchsuchen

Update to protobuf 1.6, regenerate files

Johannes Hofmann vor 7 Jahren
Ursprung
Commit
5e9b4516df
5 geänderte Dateien mit 166 neuen und 780 gelöschten Zeilen
  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 Datei anzeigen

@@ -21,7 +21,7 @@ default = ["system-libz"]
21 21
 system-libz = ["flate2"]
22 22
 
23 23
 [dependencies]
24
-protobuf = "1.4"
24
+protobuf = "1.6"
25 25
 byteorder = "1.1"
26 26
 flate2 = { version = "1.0", optional = true }
27 27
 inflate = "0.4"

+ 2
- 2
src/blob.rs Datei anzeigen

@@ -218,7 +218,7 @@ impl<R: Read> Iterator for BlobReader<R> {
218 218
 
219 219
 #[cfg(feature = "system-libz")]
220 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 222
     if blob.has_raw() {
223 223
         let size = blob.get_raw().len() as u64;
224 224
         if size < MAX_BLOB_MESSAGE_SIZE {
@@ -237,7 +237,7 @@ pub(crate) fn decode_blob<T>(blob: &fileformat::Blob) -> Result<T>
237 237
 
238 238
 #[cfg(not(feature = "system-libz"))]
239 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 241
     if blob.has_raw() {
242 242
         let size = blob.get_raw().len() as u64;
243 243
         if size < MAX_BLOB_MESSAGE_SIZE {

+ 23
- 97
src/proto/fileformat.rs Datei anzeigen

@@ -1,4 +1,4 @@
1
-// This file is generated. Do not edit
1
+// This file is generated by rust-protobuf 1.6.0. Do not edit
2 2
 // @generated
3 3
 
4 4
 // https://github.com/Manishearth/rust-clippy/issues/702
@@ -34,24 +34,11 @@ pub struct Blob {
34 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 37
 impl Blob {
41 38
     pub fn new() -> Blob {
42 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 42
     // optional bytes raw = 1;
56 43
 
57 44
     pub fn clear_raw(&mut self) {
@@ -88,14 +75,6 @@ impl Blob {
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 78
     // optional int32 raw_size = 2;
100 79
 
101 80
     pub fn clear_raw_size(&mut self) {
@@ -115,14 +94,6 @@ impl Blob {
115 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 97
     // optional bytes zlib_data = 3;
127 98
 
128 99
     pub fn clear_zlib_data(&mut self) {
@@ -159,14 +130,6 @@ impl Blob {
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 133
     // optional bytes lzma_data = 4;
171 134
 
172 135
     pub fn clear_lzma_data(&mut self) {
@@ -203,14 +166,6 @@ impl Blob {
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 169
     // optional bytes OBSOLETE_bzip2_data = 5;
215 170
 
216 171
     pub fn clear_OBSOLETE_bzip2_data(&mut self) {
@@ -246,14 +201,6 @@ impl Blob {
246 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 206
 impl ::protobuf::Message for Blob {
@@ -359,14 +306,22 @@ impl ::protobuf::Message for Blob {
359 306
     }
360 307
 
361 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 312
     fn new() -> Blob {
368 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 327
 impl ::protobuf::Clear for Blob {
@@ -397,24 +352,11 @@ pub struct BlobHeader {
397 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 355
 impl BlobHeader {
404 356
     pub fn new() -> BlobHeader {
405 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 360
     // required string type = 1;
419 361
 
420 362
     pub fn clear_field_type(&mut self) {
@@ -451,14 +393,6 @@ impl BlobHeader {
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 396
     // optional bytes indexdata = 2;
463 397
 
464 398
     pub fn clear_indexdata(&mut self) {
@@ -495,14 +429,6 @@ impl BlobHeader {
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 432
     // required int32 datasize = 3;
507 433
 
508 434
     pub fn clear_datasize(&mut self) {
@@ -521,14 +447,6 @@ impl BlobHeader {
521 447
     pub fn get_datasize(&self) -> i32 {
522 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 452
 impl ::protobuf::Message for BlobHeader {
@@ -622,14 +540,22 @@ impl ::protobuf::Message for BlobHeader {
622 540
     }
623 541
 
624 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 546
     fn new() -> BlobHeader {
631 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 561
 impl ::protobuf::Clear for BlobHeader {

+ 136
- 676
src/proto/osmformat.rs
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 4
- 4
src/util.rs Datei anzeigen

@@ -3,10 +3,10 @@ use std::io::Read;
3 3
 
4 4
 
5 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 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 10
     message.merge_from(&mut stream)?;
11 11
 
12 12
     if message.is_initialized() {
@@ -18,10 +18,10 @@ pub(crate) fn parse_message_from_bytes<M>(bytes: &[u8]) -> Result<M>
18 18
 
19 19
 pub(crate) fn parse_message_from_reader<R, M>(reader: &mut R) -> Result<M>
20 20
     where R: Read,
21
-          M: ::protobuf::Message + ::protobuf::MessageStatic,
21
+          M: ::protobuf::Message,
22 22
 {
23 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 25
     message.merge_from(&mut stream)?;
26 26
 
27 27
     stream.check_eof()?;