Struct screeps_api::data::room_name::RoomName [] [src]

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

A structure representing a room name.

Fields

Inner x coordinate representation.

0 represents E0, positive numbers represent E(x)

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

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]

[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.

[src]

Creates a new room name from the given position parameters.

Trait Implementations

impl Serialize for RoomName
[src]

[src]

Serialize this value into the given Serde serializer. Read more

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

[src]

Deserialize this value from the given Serde deserializer. Read more

impl Copy for RoomName
[src]

impl Clone for RoomName
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for RoomName
[src]

impl PartialEq for RoomName
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Hash for RoomName
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl Debug for RoomName
[src]

[src]

Formats the value using the given formatter.

impl Display for RoomName
[src]

[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 From<RoomNameAbsoluteCoordinates> for RoomName
[src]

[src]

Performs the conversion.

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

The resulting type after applying the + operator.

[src]

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

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

The resulting type after applying the - operator.

[src]

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

impl Sub<RoomName> for RoomName
[src]

The resulting type after applying the - operator.

[src]

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

impl IntoRoomName for RoomName
[src]

[src]

Turns this data into a room name, erroring if the format is not as expected.