1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
mod header;
mod point_z;
mod property_processor;
pub mod reader;
mod shp_reader;
mod shx_reader;
use thiserror::Error;
pub use header::ShapeType;
pub use property_processor::*;
pub use reader::Reader;
pub use shp_reader::NO_DATA;
#[derive(Error, Debug)]
pub enum Error {
#[error("I/O error")]
IoError(#[from] std::io::Error),
#[error("The code `{0}` does not correspond to any of the ShapeType code defined by ESRI")]
InvalidFileCode(i32),
#[error("The file code `{0}` is invalid, is this a Shapefile?")]
InvalidShapeType(i32),
#[error("Invalid patch type `{0}`")]
InvalidPatchType(i32),
#[error("The requested type: '{requested}' does not correspond to the actual shape type: '{actual}'")]
MismatchShapeType {
requested: ShapeType,
actual: ShapeType,
},
#[error("Invalid shape record size")]
InvalidShapeRecordSize,
#[error("Dbase Error")]
DbaseError(dbase::Error),
#[error("Dbf missing")]
MissingDbf,
#[error("Index file missing")]
MissingIndexFile,
#[error("Geozero error")]
GeozeroError(#[from] geozero::error::GeozeroError),
}
impl From<dbase::Error> for Error {
fn from(e: dbase::Error) -> Error {
Error::DbaseError(e)
}
}