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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
extern crate rustc_serialize;
#[derive(RustcDecodable, Debug)]
pub struct Country {
pub continent: Option<model::Continent>,
pub country: Option<model::Country>,
pub registered_country: Option<model::Country>,
pub represented_country: Option<model::RepresentedCountry>,
pub traits: Option<model::Traits>,
}
#[derive(RustcDecodable, Debug)]
pub struct City {
pub city: Option<model::City>,
pub continent: Option<model::Continent>,
pub country: Option<model::Country>,
pub location: Option<model::Location>,
pub postal: Option<model::Postal>,
pub registered_country: Option<model::Country>,
pub represented_country: Option<model::RepresentedCountry>,
pub subdivisions: Option<Vec<model::Subdivision>>,
pub traits: Option<model::Traits>,
}
pub mod model {
use std::collections::BTreeMap;
#[derive(RustcDecodable, Debug)]
pub struct City {
pub geoname_id: Option<u32>,
pub names: Option<BTreeMap<String, String>>,
}
#[derive(RustcDecodable, Debug)]
pub struct Continent {
pub code: Option<String>,
pub geoname_id: Option<u32>,
pub names: Option<BTreeMap<String, String>>,
}
#[derive(RustcDecodable, Debug)]
pub struct Country {
pub geoname_id: Option<u32>,
pub iso_code: Option<String>,
pub names: Option<BTreeMap<String, String>>,
}
#[derive(RustcDecodable, Debug)]
pub struct Location {
pub latitude: Option<f64>,
pub longitude: Option<f64>,
pub metro_code: Option<u16>,
pub time_zone: Option<String>,
}
#[derive(RustcDecodable, Debug)]
pub struct Postal {
pub code: Option<String>,
}
#[derive(RustcDecodable, Debug)]
pub struct RepresentedCountry {
pub geoname_id: Option<u32>,
pub iso_code: Option<String>,
pub names: Option<BTreeMap<String, String>>,
}
#[derive(RustcDecodable, Debug)]
pub struct Subdivision {
pub geoname_id: Option<u32>,
pub iso_code: Option<String>,
pub names: Option<BTreeMap<String, String>>,
}
#[derive(RustcDecodable, Debug)]
pub struct Traits {
pub is_anonymous_proxy: Option<bool>,
pub is_satellite_provider: Option<bool>,
}
}