use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
#[repr(u8)]
pub enum Api {
All = 0,
Directions = 1,
DistanceMatrix = 2,
Elevation = 3,
Geocoding = 4,
TimeZone = 5,
Roads = 6,
AddressValidation = 7,
Places = 8,
PlacesNew = 9,
Autocomplete = 10,
NearbySearch = 11,
PlaceDetails = 12,
PlacePhoto = 13,
TextSearch = 14,
}
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"),
Api::AddressValidation => Self::from("Address Validation"),
Api::PlacesNew => Self::from("Places (New)"),
Api::Autocomplete => Self::from("Autocomplete"),
Api::NearbySearch => Self::from("Nearby Search"),
Api::PlaceDetails => Self::from("Place Details"),
Api::PlacePhoto => Self::from("Place Photo"),
Api::TextSearch => Self::from("Text Search"),
} } }
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))
} }