Struct screeps::LocalRoomName

source ·
pub struct LocalRoomName {
    pub x_coord: i32,
    pub y_coord: i32,
}
Expand description

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)

Implementations

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.

Creates a new room name from the given position parameters.

Trait Implementations

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

The resulting type after applying the + operator.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more

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.

Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

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

The resulting type after applying the - operator.

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

The resulting type after applying the - operator.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Casts this value as the target type, making the assumption that the types are correct. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.