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
use serde::{Serialize, Deserialize};
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub enum Api {
All,
Directions,
DistanceMatrix,
Elevation,
Geocoding,
TimeZone,
}
impl std::convert::From<&Api> for String {
fn from(api: &Api) -> String {
match api {
Api::All => String::from("All"),
Api::Directions => String::from("Directions"),
Api::DistanceMatrix => String::from("Distance Matrix"),
Api::Elevation => String::from("Elevation"),
Api::Geocoding => String::from("Geocoding"),
Api::TimeZone => String::from("Time Zone"),
}
}
}
impl std::default::Default for Api {
fn default() -> Self {
Api::All
}
}
impl std::fmt::Display for Api {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.to_string())
}
}