[][src]Struct screeps::LocalRoomName

pub struct LocalRoomName {
    pub x_coord: i32,
    pub y_coord: i32,
}

A structure representing a room name.

Fields

x_coord: i32

Inner x coordinate representation.

0 represents E0, positive numbers represent E(x)

-1 represents W0, negative numbers represent W((-x) - 1)

y_coord: i32

Inner y coordinate representation.

0 represents N0, positive numbers represent N(y)

-1 represents S0, negative numbers represent S((-y) - 1)

Methods

impl LocalRoomName[src]

pub fn new<T: ?Sized>(x: &T) -> Result<Self, LocalRoomNameParseError> where
    T: AsRef<str>, 
[src]

Creates a new room name from the given input.

This will parse the input, and return an error if it is in an invalid format.

pub fn from_coords(east: bool, north: bool, x_pos: i32, y_pos: i32) -> Self[src]

Creates a new room name from the given position parameters.

Trait Implementations

impl Clone for LocalRoomName[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for LocalRoomName[src]

impl Copy for LocalRoomName[src]

impl PartialEq<LocalRoomName> for LocalRoomName[src]

impl Display for LocalRoomName[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Formats this room name into the format the game expects.

Resulting string will be (E|W)[0-9]+(N|S)[0-9]+, and will result in the same LocalRoomName if passed into LocalRoomName::new.

impl Debug for LocalRoomName[src]

impl Add<(i32, i32)> for LocalRoomName[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, (x, y): (i32, i32)) -> Self[src]

Adds an (x, y) coordinate pair to this room name.

impl Sub<(i32, i32)> for LocalRoomName[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, (x, y): (i32, i32)) -> Self[src]

Subtracts an (x, y) coordinate pair to this room name.

impl Sub<LocalRoomName> for LocalRoomName[src]

type Output = (i32, i32)

The resulting type after applying the - operator.

fn sub(self, other: LocalRoomName) -> (i32, i32)[src]

Subtracts an (x, y) coordinate pair to this room name.

impl Hash for LocalRoomName[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Serialize for LocalRoomName[src]

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

impl TryFrom<Value> for LocalRoomName

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<LocalRoomName> for Value

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_a> TryFrom<&'_a LocalRoomName> for Value

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_a> TryFrom<&'_a mut LocalRoomName> for Value

type Error = ConversionError

The type returned in the event of a conversion error.

impl JsSerialize for LocalRoomName

impl JsSerializeOwned for LocalRoomName

impl<'_r> JsSerializeOwned for &'_r LocalRoomName

Auto Trait Implementations

Blanket Implementations

impl<T, U> IntoExpectedType for T where
    U: FromExpectedType<T>, 
[src]

impl<T> From for T[src]

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

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

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

The type returned in the event of a conversion error.