6 Commits

Author SHA1 Message Date
  Johannes Hofmann 7ff5efabf2 Fix compiler warnings 6 years ago
  Johannes Hofmann 7bf89809d3 Regenerate *.rs files in `src/proto/` 6 years ago
  Johannes Hofmann 7819fd571c CI: Disable caching of cargo directories 6 years ago
  Johannes Hofmann bc858ab6da CI: Bump minimum supported Rust version to 1.34.2 6 years ago
  Johannes Hofmann 592663c8d7 CI: Bump minimum supported Rust version to 1.27.2 6 years ago
  Johannes Hofmann 30a93e56e8 CI: Bump minimum supported Rust version to 1.26.2 6 years ago
6 changed files with 598 additions and 509 deletions
  1. 2
    7
      .appveyor.yml
  2. 4
    10
      .travis.yml
  3. 1
    1
      src/error.rs
  4. 1
    1
      src/mmap_blob.rs
  5. 90
    73
      src/proto/fileformat.rs
  6. 500
    417
      src/proto/osmformat.rs

+ 2
- 7
.appveyor.yml View File

8
   matrix:
8
   matrix:
9
     - channel: nightly
9
     - channel: nightly
10
       target: x86_64-pc-windows-msvc
10
       target: x86_64-pc-windows-msvc
11
-      cargoflags: --no-default-features
12
     - channel: nightly
11
     - channel: nightly
13
       target: x86_64-pc-windows-gnu
12
       target: x86_64-pc-windows-gnu
14
-      cargoflags: --no-default-features
15
     - channel: nightly
13
     - channel: nightly
16
       target: i686-pc-windows-gnu
14
       target: i686-pc-windows-gnu
17
-      cargoflags: --no-default-features
18
     - channel: stable
15
     - channel: stable
19
       target: x86_64-pc-windows-msvc
16
       target: x86_64-pc-windows-msvc
20
-      cargoflags: --no-default-features
21
     - channel: stable
17
     - channel: stable
22
       target: i686-pc-windows-msvc
18
       target: i686-pc-windows-msvc
23
-      cargoflags: --no-default-features
24
-    - channel: 1.24.1
19
+    - channel: 1.34.2
25
       target: x86_64-pc-windows-msvc
20
       target: x86_64-pc-windows-msvc
26
 
21
 
27
 install:
22
 install:
41
 
36
 
42
 test_script:
37
 test_script:
43
   - cargo test --verbose
38
   - cargo test --verbose
44
-  - cargo test --verbose %cargoflags%
39
+  - cargo test --verbose --no-default-features

+ 4
- 10
.travis.yml View File

1
 dist: trusty
1
 dist: trusty
2
 sudo: false
2
 sudo: false
3
 language: rust
3
 language: rust
4
-cache: cargo
5
 rust:
4
 rust:
6
   - stable
5
   - stable
7
   - beta
6
   - beta
8
   - nightly
7
   - nightly
9
-  - 1.24.1
8
+  - 1.34.2
10
 script:
9
 script:
11
   - |
10
   - |
12
-      if [ "$TRAVIS_RUST_VERSION" == "1.24.1" ]; then
13
-        cargo test --verbose;
14
-        cargo doc --verbose --no-deps;
15
-      else
16
-        cargo test --verbose;
17
-        cargo test --verbose --no-default-features;
18
-        cargo doc --verbose;
19
-      fi
11
+      cargo test --verbose;
12
+      cargo test --verbose --no-default-features;
13
+      cargo doc --verbose;

+ 1
- 1
src/error.rs View File

116
         }
116
         }
117
     }
117
     }
118
 
118
 
119
-    fn cause(&self) -> Option<&StdError> {
119
+    fn cause(&self) -> Option<&dyn StdError> {
120
         match *self.0 {
120
         match *self.0 {
121
             ErrorKind::Io(ref err) => Some(err),
121
             ErrorKind::Io(ref err) => Some(err),
122
             ErrorKind::Protobuf{ref err, ..} => Some(err),
122
             ErrorKind::Protobuf{ref err, ..} => Some(err),

+ 1
- 1
src/mmap_blob.rs View File

190
 
190
 
191
         match slice.len() {
191
         match slice.len() {
192
             0 => return None,
192
             0 => return None,
193
-            1 ... 3 => {
193
+            1 ..= 3 => {
194
                 self.last_blob_ok = false;
194
                 self.last_blob_ok = false;
195
                 return Some(Err(new_blob_error(BlobError::InvalidHeaderSize)));
195
                 return Some(Err(new_blob_error(BlobError::InvalidHeaderSize)));
196
             },
196
             },

+ 90
- 73
src/proto/fileformat.rs View File

1
-// This file is generated by rust-protobuf 2.0.0. Do not edit
1
+// This file is generated by rust-protobuf 2.8.1. 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
5
 #![allow(unknown_lints)]
5
 #![allow(unknown_lints)]
6
-#![allow(clippy)]
6
+#![allow(clippy::all)]
7
 
7
 
8
 #![cfg_attr(rustfmt, rustfmt_skip)]
8
 #![cfg_attr(rustfmt, rustfmt_skip)]
9
 
9
 
17
 #![allow(unsafe_code)]
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
 
21
 
21
 use protobuf::Message as Message_imported_for_functions;
22
 use protobuf::Message as Message_imported_for_functions;
22
 use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
23
 use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
23
 
24
 
25
+/// Generated files are compatible only with the same version
26
+/// of protobuf runtime.
27
+const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_8_1;
28
+
24
 #[derive(PartialEq,Clone,Default,Debug)]
29
 #[derive(PartialEq,Clone,Default,Debug)]
25
 pub struct Blob {
30
 pub struct Blob {
26
     // message fields
31
     // message fields
30
     lzma_data: ::protobuf::SingularField<::std::vec::Vec<u8>>,
35
     lzma_data: ::protobuf::SingularField<::std::vec::Vec<u8>>,
31
     OBSOLETE_bzip2_data: ::protobuf::SingularField<::std::vec::Vec<u8>>,
36
     OBSOLETE_bzip2_data: ::protobuf::SingularField<::std::vec::Vec<u8>>,
32
     // special fields
37
     // special fields
33
-    unknown_fields: ::protobuf::UnknownFields,
34
-    cached_size: ::protobuf::CachedSize,
38
+    pub unknown_fields: ::protobuf::UnknownFields,
39
+    pub cached_size: ::protobuf::CachedSize,
40
+}
41
+
42
+impl<'a> ::std::default::Default for &'a Blob {
43
+    fn default() -> &'a Blob {
44
+        <Blob as ::protobuf::Message>::default_instance()
45
+    }
35
 }
46
 }
36
 
47
 
37
 impl Blob {
48
 impl Blob {
41
 
52
 
42
     // optional bytes raw = 1;
53
     // optional bytes raw = 1;
43
 
54
 
55
+
56
+    pub fn get_raw(&self) -> &[u8] {
57
+        match self.raw.as_ref() {
58
+            Some(v) => &v,
59
+            None => &[],
60
+        }
61
+    }
44
     pub fn clear_raw(&mut self) {
62
     pub fn clear_raw(&mut self) {
45
         self.raw.clear();
63
         self.raw.clear();
46
     }
64
     }
68
         self.raw.take().unwrap_or_else(|| ::std::vec::Vec::new())
86
         self.raw.take().unwrap_or_else(|| ::std::vec::Vec::new())
69
     }
87
     }
70
 
88
 
71
-    pub fn get_raw(&self) -> &[u8] {
72
-        match self.raw.as_ref() {
73
-            Some(v) => &v,
74
-            None => &[],
75
-        }
76
-    }
77
-
78
     // optional int32 raw_size = 2;
89
     // optional int32 raw_size = 2;
79
 
90
 
91
+
92
+    pub fn get_raw_size(&self) -> i32 {
93
+        self.raw_size.unwrap_or(0)
94
+    }
80
     pub fn clear_raw_size(&mut self) {
95
     pub fn clear_raw_size(&mut self) {
81
         self.raw_size = ::std::option::Option::None;
96
         self.raw_size = ::std::option::Option::None;
82
     }
97
     }
90
         self.raw_size = ::std::option::Option::Some(v);
105
         self.raw_size = ::std::option::Option::Some(v);
91
     }
106
     }
92
 
107
 
93
-    pub fn get_raw_size(&self) -> i32 {
94
-        self.raw_size.unwrap_or(0)
95
-    }
96
-
97
     // optional bytes zlib_data = 3;
108
     // optional bytes zlib_data = 3;
98
 
109
 
110
+
111
+    pub fn get_zlib_data(&self) -> &[u8] {
112
+        match self.zlib_data.as_ref() {
113
+            Some(v) => &v,
114
+            None => &[],
115
+        }
116
+    }
99
     pub fn clear_zlib_data(&mut self) {
117
     pub fn clear_zlib_data(&mut self) {
100
         self.zlib_data.clear();
118
         self.zlib_data.clear();
101
     }
119
     }
123
         self.zlib_data.take().unwrap_or_else(|| ::std::vec::Vec::new())
141
         self.zlib_data.take().unwrap_or_else(|| ::std::vec::Vec::new())
124
     }
142
     }
125
 
143
 
126
-    pub fn get_zlib_data(&self) -> &[u8] {
127
-        match self.zlib_data.as_ref() {
144
+    // optional bytes lzma_data = 4;
145
+
146
+
147
+    pub fn get_lzma_data(&self) -> &[u8] {
148
+        match self.lzma_data.as_ref() {
128
             Some(v) => &v,
149
             Some(v) => &v,
129
             None => &[],
150
             None => &[],
130
         }
151
         }
131
     }
152
     }
132
-
133
-    // optional bytes lzma_data = 4;
134
-
135
     pub fn clear_lzma_data(&mut self) {
153
     pub fn clear_lzma_data(&mut self) {
136
         self.lzma_data.clear();
154
         self.lzma_data.clear();
137
     }
155
     }
159
         self.lzma_data.take().unwrap_or_else(|| ::std::vec::Vec::new())
177
         self.lzma_data.take().unwrap_or_else(|| ::std::vec::Vec::new())
160
     }
178
     }
161
 
179
 
162
-    pub fn get_lzma_data(&self) -> &[u8] {
163
-        match self.lzma_data.as_ref() {
180
+    // optional bytes OBSOLETE_bzip2_data = 5;
181
+
182
+
183
+    pub fn get_OBSOLETE_bzip2_data(&self) -> &[u8] {
184
+        match self.OBSOLETE_bzip2_data.as_ref() {
164
             Some(v) => &v,
185
             Some(v) => &v,
165
             None => &[],
186
             None => &[],
166
         }
187
         }
167
     }
188
     }
168
-
169
-    // optional bytes OBSOLETE_bzip2_data = 5;
170
-
171
     pub fn clear_OBSOLETE_bzip2_data(&mut self) {
189
     pub fn clear_OBSOLETE_bzip2_data(&mut self) {
172
         self.OBSOLETE_bzip2_data.clear();
190
         self.OBSOLETE_bzip2_data.clear();
173
     }
191
     }
194
     pub fn take_OBSOLETE_bzip2_data(&mut self) -> ::std::vec::Vec<u8> {
212
     pub fn take_OBSOLETE_bzip2_data(&mut self) -> ::std::vec::Vec<u8> {
195
         self.OBSOLETE_bzip2_data.take().unwrap_or_else(|| ::std::vec::Vec::new())
213
         self.OBSOLETE_bzip2_data.take().unwrap_or_else(|| ::std::vec::Vec::new())
196
     }
214
     }
197
-
198
-    pub fn get_OBSOLETE_bzip2_data(&self) -> &[u8] {
199
-        match self.OBSOLETE_bzip2_data.as_ref() {
200
-            Some(v) => &v,
201
-            None => &[],
202
-        }
203
-    }
204
 }
215
 }
205
 
216
 
206
 impl ::protobuf::Message for Blob {
217
 impl ::protobuf::Message for Blob {
208
         true
219
         true
209
     }
220
     }
210
 
221
 
211
-    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
222
+    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
212
         while !is.eof()? {
223
         while !is.eof()? {
213
             let (field_number, wire_type) = is.read_tag_unpack()?;
224
             let (field_number, wire_type) = is.read_tag_unpack()?;
214
             match field_number {
225
             match field_number {
263
         my_size
274
         my_size
264
     }
275
     }
265
 
276
 
266
-    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
277
+    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
267
         if let Some(ref v) = self.raw.as_ref() {
278
         if let Some(ref v) = self.raw.as_ref() {
268
             os.write_bytes(1, &v)?;
279
             os.write_bytes(1, &v)?;
269
         }
280
         }
295
         &mut self.unknown_fields
306
         &mut self.unknown_fields
296
     }
307
     }
297
 
308
 
298
-    fn as_any(&self) -> &::std::any::Any {
299
-        self as &::std::any::Any
309
+    fn as_any(&self) -> &dyn (::std::any::Any) {
310
+        self as &dyn (::std::any::Any)
300
     }
311
     }
301
-    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
302
-        self as &mut ::std::any::Any
312
+    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
313
+        self as &mut dyn (::std::any::Any)
303
     }
314
     }
304
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
315
+    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
305
         self
316
         self
306
     }
317
     }
307
 
318
 
326
 
337
 
327
 impl ::protobuf::Clear for Blob {
338
 impl ::protobuf::Clear for Blob {
328
     fn clear(&mut self) {
339
     fn clear(&mut self) {
329
-        self.clear_raw();
330
-        self.clear_raw_size();
331
-        self.clear_zlib_data();
332
-        self.clear_lzma_data();
333
-        self.clear_OBSOLETE_bzip2_data();
340
+        self.raw.clear();
341
+        self.raw_size = ::std::option::Option::None;
342
+        self.zlib_data.clear();
343
+        self.lzma_data.clear();
344
+        self.OBSOLETE_bzip2_data.clear();
334
         self.unknown_fields.clear();
345
         self.unknown_fields.clear();
335
     }
346
     }
336
 }
347
 }
348
     indexdata: ::protobuf::SingularField<::std::vec::Vec<u8>>,
359
     indexdata: ::protobuf::SingularField<::std::vec::Vec<u8>>,
349
     datasize: ::std::option::Option<i32>,
360
     datasize: ::std::option::Option<i32>,
350
     // special fields
361
     // special fields
351
-    unknown_fields: ::protobuf::UnknownFields,
352
-    cached_size: ::protobuf::CachedSize,
362
+    pub unknown_fields: ::protobuf::UnknownFields,
363
+    pub cached_size: ::protobuf::CachedSize,
364
+}
365
+
366
+impl<'a> ::std::default::Default for &'a BlobHeader {
367
+    fn default() -> &'a BlobHeader {
368
+        <BlobHeader as ::protobuf::Message>::default_instance()
369
+    }
353
 }
370
 }
354
 
371
 
355
 impl BlobHeader {
372
 impl BlobHeader {
359
 
376
 
360
     // required string type = 1;
377
     // required string type = 1;
361
 
378
 
379
+
380
+    pub fn get_field_type(&self) -> &str {
381
+        match self.field_type.as_ref() {
382
+            Some(v) => &v,
383
+            None => "",
384
+        }
385
+    }
362
     pub fn clear_field_type(&mut self) {
386
     pub fn clear_field_type(&mut self) {
363
         self.field_type.clear();
387
         self.field_type.clear();
364
     }
388
     }
386
         self.field_type.take().unwrap_or_else(|| ::std::string::String::new())
410
         self.field_type.take().unwrap_or_else(|| ::std::string::String::new())
387
     }
411
     }
388
 
412
 
389
-    pub fn get_field_type(&self) -> &str {
390
-        match self.field_type.as_ref() {
413
+    // optional bytes indexdata = 2;
414
+
415
+
416
+    pub fn get_indexdata(&self) -> &[u8] {
417
+        match self.indexdata.as_ref() {
391
             Some(v) => &v,
418
             Some(v) => &v,
392
-            None => "",
419
+            None => &[],
393
         }
420
         }
394
     }
421
     }
395
-
396
-    // optional bytes indexdata = 2;
397
-
398
     pub fn clear_indexdata(&mut self) {
422
     pub fn clear_indexdata(&mut self) {
399
         self.indexdata.clear();
423
         self.indexdata.clear();
400
     }
424
     }
422
         self.indexdata.take().unwrap_or_else(|| ::std::vec::Vec::new())
446
         self.indexdata.take().unwrap_or_else(|| ::std::vec::Vec::new())
423
     }
447
     }
424
 
448
 
425
-    pub fn get_indexdata(&self) -> &[u8] {
426
-        match self.indexdata.as_ref() {
427
-            Some(v) => &v,
428
-            None => &[],
429
-        }
430
-    }
431
-
432
     // required int32 datasize = 3;
449
     // required int32 datasize = 3;
433
 
450
 
451
+
452
+    pub fn get_datasize(&self) -> i32 {
453
+        self.datasize.unwrap_or(0)
454
+    }
434
     pub fn clear_datasize(&mut self) {
455
     pub fn clear_datasize(&mut self) {
435
         self.datasize = ::std::option::Option::None;
456
         self.datasize = ::std::option::Option::None;
436
     }
457
     }
443
     pub fn set_datasize(&mut self, v: i32) {
464
     pub fn set_datasize(&mut self, v: i32) {
444
         self.datasize = ::std::option::Option::Some(v);
465
         self.datasize = ::std::option::Option::Some(v);
445
     }
466
     }
446
-
447
-    pub fn get_datasize(&self) -> i32 {
448
-        self.datasize.unwrap_or(0)
449
-    }
450
 }
467
 }
451
 
468
 
452
 impl ::protobuf::Message for BlobHeader {
469
 impl ::protobuf::Message for BlobHeader {
460
         true
477
         true
461
     }
478
     }
462
 
479
 
463
-    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> {
480
+    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
464
         while !is.eof()? {
481
         while !is.eof()? {
465
             let (field_number, wire_type) = is.read_tag_unpack()?;
482
             let (field_number, wire_type) = is.read_tag_unpack()?;
466
             match field_number {
483
             match field_number {
503
         my_size
520
         my_size
504
     }
521
     }
505
 
522
 
506
-    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> {
523
+    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
507
         if let Some(ref v) = self.field_type.as_ref() {
524
         if let Some(ref v) = self.field_type.as_ref() {
508
             os.write_string(1, &v)?;
525
             os.write_string(1, &v)?;
509
         }
526
         }
529
         &mut self.unknown_fields
546
         &mut self.unknown_fields
530
     }
547
     }
531
 
548
 
532
-    fn as_any(&self) -> &::std::any::Any {
533
-        self as &::std::any::Any
549
+    fn as_any(&self) -> &dyn (::std::any::Any) {
550
+        self as &dyn (::std::any::Any)
534
     }
551
     }
535
-    fn as_any_mut(&mut self) -> &mut ::std::any::Any {
536
-        self as &mut ::std::any::Any
552
+    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
553
+        self as &mut dyn (::std::any::Any)
537
     }
554
     }
538
-    fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {
555
+    fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
539
         self
556
         self
540
     }
557
     }
541
 
558
 
560
 
577
 
561
 impl ::protobuf::Clear for BlobHeader {
578
 impl ::protobuf::Clear for BlobHeader {
562
     fn clear(&mut self) {
579
     fn clear(&mut self) {
563
-        self.clear_field_type();
564
-        self.clear_indexdata();
565
-        self.clear_datasize();
580
+        self.field_type.clear();
581
+        self.indexdata.clear();
582
+        self.datasize = ::std::option::Option::None;
566
         self.unknown_fields.clear();
583
         self.unknown_fields.clear();
567
     }
584
     }
568
 }
585
 }

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