[][src]Struct screeps_api::RoomName

pub struct RoomName {
    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 RoomName[src]

pub fn new<T: ?Sized>(x: &T) -> Result<Self, RoomNameParseError> where
    T: IntoRoomName
[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_pos(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 IntoRoomName for RoomName[src]

impl PartialEq<RoomName> for RoomName[src]

impl Clone for RoomName[src]

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

Performs copy-assignment from source. Read more

impl From<RoomName> for RoomNameAbsoluteCoordinates[src]

impl From<RoomNameAbsoluteCoordinates> for RoomName[src]

impl Copy for RoomName[src]

impl Eq for RoomName[src]

impl Hash for RoomName[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 Debug for RoomName[src]

impl Display for RoomName[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 an equal same RoomName if passed into into_room_name.

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

type Output = RoomName

The resulting type after applying the + operator.

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

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

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

type Output = RoomName

The resulting type after applying the - operator.

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

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

impl Sub<RoomName> for RoomName[src]

type Output = (i32, i32)

The resulting type after applying the - operator.

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

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

impl Serialize for RoomName[src]

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

Auto Trait Implementations

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,