mindat_rs/models/
common.rs1use serde::{Deserialize, Serialize};
4
5use super::serde_helpers::deserialize_optional_i32;
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Relation {
10 pub mineral_id: i32,
12 pub relation_type: i32,
17 pub relation_type_text: String,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct MinStats {
24 pub ms_photos: i32,
26 pub ms_locentries: i32,
28 pub ms_photovotes: i32,
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct GeoJsonFeature<P> {
35 #[serde(rename = "type")]
37 pub feature_type: String,
38 pub id: Option<i32>,
40 pub geometry: Option<GeoJsonGeometry>,
42 pub properties: P,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(tag = "type")]
49pub enum GeoJsonGeometry {
50 Point { coordinates: Vec<f64> },
51 LineString { coordinates: Vec<Vec<f64>> },
52 Polygon { coordinates: Vec<Vec<Vec<f64>>> },
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct GeoJsonFeatureCollection<P> {
58 #[serde(rename = "type")]
60 pub collection_type: String,
61 pub features: Vec<GeoJsonFeature<P>>,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct GeoRegionProperties {
68 pub lgr_revtxtd: Option<String>,
70 pub lgr_updttime: Option<String>,
72 #[serde(default, deserialize_with = "deserialize_optional_i32")]
74 pub lgr_non_hierarchical: Option<i32>,
75}