Skip to main content

Location

Struct Location 

Source
pub struct Location { /* private fields */ }
Expand description

Represents a player’s geographic location as recorded in the ghost file header, consisting of a country, subregion, and regions version.

Implementations§

Source§

impl Location

Source

pub fn country(&self) -> Country

Returns the country component of this location.

Source

pub fn subregion(&self) -> Subregion

Returns the subregion component of this location.

Source

pub fn version(&self) -> Version

Returns the region version associated with this location.

Source

pub fn find( country_id: u8, subregion_id: u8, version: Option<Version>, ) -> Option<Location>

Looks up a Location by country ID, subregion ID, and optional region version.

If version is None, the lookup may return an adjusted match (i.e. the closest valid location). Both exact and adjusted matches are returned as Some.

Returns None if no matching location can be found.

§Arguments
  • country_id - The numeric country identifier.
  • subregion_id - The numeric subregion identifier.
  • version - An optional region version to constrain the lookup.
Source

pub fn find_exact( country_id: u8, subregion_id: u8, version: Version, ) -> Option<Location>

Looks up a Location by country ID, subregion ID, and exact version.

Unlike Location::find, this only returns Some when the lookup produces an exact match. Adjusted matches and missing entries both return None.

§Arguments
  • country_id - The numeric country identifier.
  • subregion_id - The numeric subregion identifier.
  • version - The region version that must match exactly.
Source

pub fn change_version(&self, version: Version) -> Option<Self>

Returns a new Location with the same country and subregion but a different version.

Returns None if no exact location entry exists for this country/subregion combination under the requested version.

§Arguments
  • version - The new region version to look up for this location’s country ID and subregion ID.

Trait Implementations§

Source§

impl Default for Location

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.