pub struct CityName {
pub country: String,
pub city: String,
}
Expand description
A single city is identified using this.
Fields§
§country: String
A two letter lowercase country code, from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.
To represent imaginary/test cities, use the code zz
.
city: String
The name of the city, in filename-friendly form – for example, “tel_aviv”.
Implementations§
Source§impl CityName
impl CityName
Sourcepub fn new(country: &str, city: &str) -> CityName
pub fn new(country: &str, city: &str) -> CityName
Create a CityName from a country code and city.
Sourcefn list_all_cities_locally() -> Vec<CityName>
fn list_all_cities_locally() -> Vec<CityName>
Returns all city names available locally.
Sourcefn list_all_cities_from_manifest(manifest: &Manifest) -> Vec<CityName>
fn list_all_cities_from_manifest(manifest: &Manifest) -> Vec<CityName>
Returns all city names based on the manifest of available files.
Sourcepub fn list_all_cities_merged(manifest: &Manifest) -> Vec<CityName>
pub fn list_all_cities_merged(manifest: &Manifest) -> Vec<CityName>
Returns all city names either available locally or based on the manifest of available files.
Sourcepub fn list_all_cities_from_importer_config() -> Vec<CityName>
pub fn list_all_cities_from_importer_config() -> Vec<CityName>
Returns all city names based on importer config.
Sourcepub fn list_all_maps_in_city_from_importer_config(&self) -> Vec<MapName>
pub fn list_all_maps_in_city_from_importer_config(&self) -> Vec<MapName>
Returns all maps in a city based on importer config.
Sourcepub fn parse(x: &str) -> Result<CityName>
pub fn parse(x: &str) -> Result<CityName>
Parses a CityName from something like “gb/london”; the inverse of to_path
.
Sourcepub fn to_path(&self) -> String
pub fn to_path(&self) -> String
Expresses the city as a path, like “gb/london”; the inverse of parse
.
Sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
Stringify the city name for debug messages. Don’t implement std::fmt::Display
, to force
callers to explicitly opt into this description, which could change.
Sourcepub fn input_path<I: AsRef<str>>(&self, file: I) -> String
pub fn input_path<I: AsRef<str>>(&self, file: I) -> String
Constructs the path to some city-scoped data/input.
Sourcepub fn uses_metric(&self) -> bool
pub fn uses_metric(&self) -> bool
Should metric units be used by default for this map? (Imperial if false)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CityName
impl<'de> Deserialize<'de> for CityName
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for CityName
impl Ord for CityName
Source§impl PartialOrd for CityName
impl PartialOrd for CityName
impl Eq for CityName
impl StructuralPartialEq for CityName
Auto Trait Implementations§
impl Freeze for CityName
impl RefUnwindSafe for CityName
impl Send for CityName
impl Sync for CityName
impl Unpin for CityName
impl UnwindSafe for CityName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.