Struct screeps::LocalRoomName
[−]
[src]
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]
T: AsRef<str>,
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 Serialize for LocalRoomName
[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 LocalRoomName
[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 TryFrom<Value> for LocalRoomName
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
Performs the conversion.
impl JsSerializeOwned for LocalRoomName
fn into_js_owned<'_a>(
value: &'_a mut Option<Self>,
arena: &'_a PreallocatedArena
) -> SerializedValue<'_a>
value: &'_a mut Option<Self>,
arena: &'_a PreallocatedArena
) -> SerializedValue<'_a>
fn memory_required_owned(&self) -> usize
impl<'_r> JsSerializeOwned for &'_r LocalRoomName
fn into_js_owned<'_a>(
value: &'_a mut Option<Self>,
arena: &'_a PreallocatedArena
) -> SerializedValue<'_a>
value: &'_a mut Option<Self>,
arena: &'_a PreallocatedArena
) -> SerializedValue<'_a>
fn memory_required_owned(&self) -> usize
impl JsSerialize for LocalRoomName
fn _into_js<'x>(&'x self, arena: &'x PreallocatedArena) -> SerializedValue<'x>
fn _memory_required(&self) -> usize
impl TryFrom<LocalRoomName> for Value
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: LocalRoomName) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_a> TryFrom<&'_a LocalRoomName> for Value
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &'_a LocalRoomName) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_a> TryFrom<&'_a mut LocalRoomName> for Value
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &'_a mut LocalRoomName) -> Result<Self, Self::Error>
Performs the conversion.
impl Copy for LocalRoomName
[src]
impl Clone for LocalRoomName
[src]
fn clone(&self) -> LocalRoomName
[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 LocalRoomName
[src]
impl PartialEq for LocalRoomName
[src]
fn eq(&self, __arg_0: &LocalRoomName) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &LocalRoomName) -> bool
[src]
This method tests for !=
.
impl Hash for LocalRoomName
[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 LocalRoomName
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
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 Add<(i32, i32)> for LocalRoomName
[src]
type Output = LocalRoomName
The resulting type after applying the +
operator.
fn add(self, (x, y): (i32, i32)) -> LocalRoomName
[src]
Adds an (x, y) coordinate pair to this room name.
impl Sub<(i32, i32)> for LocalRoomName
[src]
type Output = LocalRoomName
The resulting type after applying the -
operator.
fn sub(self, (x, y): (i32, i32)) -> LocalRoomName
[src]
Subtracts an (x, y) coordinate pair to this room name.