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
sourceimpl 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>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn list_all_cities_locally() -> Vec<CityName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns all city names available locally.
sourcefn list_all_cities_from_manifest(manifest: &Manifest) -> Vec<CityName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn list_all_cities_from_manifest(manifest: &Manifest) -> Vec<CityName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns all city names based on the manifest of available files.
sourcepub fn list_all_cities_merged(manifest: &Manifest) -> Vec<CityName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn list_all_cities_merged(manifest: &Manifest) -> Vec<CityName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn list_all_cities_from_importer_config() -> Vec<CityName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns all city names based on importer config.
sourcepub fn list_all_maps_in_city_from_importer_config(&self) -> Vec<MapName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn list_all_maps_in_city_from_importer_config(&self) -> Vec<MapName>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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
sourceimpl<'de> Deserialize<'de> for CityName
impl<'de> Deserialize<'de> for CityName
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for CityName
impl Ord for CityName
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<CityName> for CityName
impl PartialOrd<CityName> for CityName
sourcefn partial_cmp(&self, other: &CityName) -> Option<Ordering>
fn partial_cmp(&self, other: &CityName) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for CityName
impl StructuralEq for CityName
impl StructuralPartialEq for CityName
Auto Trait Implementations
impl RefUnwindSafe for CityName
impl Send for CityName
impl Sync for CityName
impl Unpin for CityName
impl UnwindSafe for CityName
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more