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
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]
fn new<T: ?Sized>(x: &T) -> Result<Self, RoomNameParseError> where
T: IntoRoomName,
[src]
T: IntoRoomName,
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.
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 Serialize for RoomName
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for RoomName
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for RoomName
[src]
impl Clone for RoomName
[src]
fn clone(&self) -> RoomName
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for RoomName
[src]
impl PartialEq for RoomName
[src]
fn eq(&self, __arg_0: &RoomName) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RoomName) -> bool
[src]
This method tests for !=
.
impl Hash for RoomName
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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 From<RoomNameAbsoluteCoordinates> for RoomName
[src]
fn from(other: RoomNameAbsoluteCoordinates) -> RoomName
[src]
Performs the conversion.
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 IntoRoomName for RoomName
[src]
fn into_room_name(&self) -> Result<RoomName, RoomNameParseError>
[src]
Turns this data into a room name, erroring if the format is not as expected.