[][src]Struct abstio::CityName

pub struct CityName {
    pub country: String,
    pub city: String,
}

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

impl CityName[src]

pub fn new(country: &str, city: &str) -> CityName[src]

Create a CityName from a country code and city.

pub fn seattle() -> CityName[src]

Convenient constructor for the main city of the game.

pub fn list_all_cities_from_system_data() -> Vec<CityName>[src]

Returns all city names based on system data.

pub fn list_all_cities_from_importer_config() -> Vec<CityName>[src]

Returns all city names based on importer config.

pub fn parse(x: &str) -> Result<CityName>[src]

Parses a CityName from something like "gb/london"; the inverse of to_path.

pub fn to_path(&self) -> String[src]

Expresses the city as a path, like "gb/london"; the inverse of parse.

pub fn describe(&self) -> String[src]

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.

pub fn input_path<I: Into<String>>(&self, file: I) -> String[src]

Constructs the path to some city-scoped data/input.

Trait Implementations

impl Clone for CityName[src]

impl Debug for CityName[src]

impl<'de> Deserialize<'de> for CityName[src]

impl Eq for CityName[src]

impl Ord for CityName[src]

impl PartialEq<CityName> for CityName[src]

impl PartialOrd<CityName> for CityName[src]

impl Serialize for CityName[src]

impl StructuralEq for CityName[src]

impl StructuralPartialEq for CityName[src]

Auto Trait Implementations

impl RefUnwindSafe for CityName[src]

impl Send for CityName[src]

impl Sync for CityName[src]

impl Unpin for CityName[src]

impl UnwindSafe for CityName[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.