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