[−][src]Struct screeps::RoomName
A structure representing a room name.
Methods
impl RoomName
[src]
pub fn new<T: ?Sized>(x: &T) -> Result<Self, RoomNameParseError> where
T: AsRef<str>,
[src]
T: AsRef<str>,
Parses a room name from a string.
This will parse the input string, returning an error if it is in an invalid room name.
The expected format can be represented by the regex
[ewEW][0-9]+[nsNS][0-9]+
.
pub fn to_array_string(&self) -> ArrayString<[u8; 8]>
[src]
Converts this RoomName into an efficient, stack-based string.
This is equivalent to ToString::to_string
, but involves no
allocation.
Trait Implementations
impl Clone for RoomName
[src]
fn clone(&self) -> RoomName
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<RoomName> for RoomName
[src]
impl PartialEq<str> for RoomName
[src]
fn eq(&self, other: &str) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<RoomName> for str
[src]
fn eq(&self, other: &RoomName) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> PartialEq<&'_ str> for RoomName
[src]
fn eq(&self, other: &&str) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> PartialEq<RoomName> for &'_ str
[src]
fn eq(&self, other: &RoomName) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<String> for RoomName
[src]
fn eq(&self, other: &String) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<RoomName> for String
[src]
fn eq(&self, other: &RoomName) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> PartialEq<&'_ String> for RoomName
[src]
fn eq(&self, other: &&String) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> PartialEq<RoomName> for &'_ String
[src]
fn eq(&self, other: &RoomName) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Copy for RoomName
[src]
impl Eq 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 the same RoomName if passed into RoomName::new
.
impl Debug for RoomName
[src]
impl Add<(i32, i32)> for RoomName
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, (x, y): (i32, i32)) -> Self
[src]
Offsets this room name by a given horizontal and vertical (x, y) pair.
The first number offsets to the west when negative and to the east when positive. The first number offsets to the north when negative and to the south when positive.
Panics
Will panic if the addition overflows the boundaries of RoomName.
impl Sub<(i32, i32)> for RoomName
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, (x, y): (i32, i32)) -> Self
[src]
Offsets this room name in the opposite direction from the coordinates.
See the implementation for Add<(i32, i32)>
.
Panics
Will panic if the subtraction overflows the boundaries of RoomName.
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 one room name from the other, extracting the difference.
The first return value represents east/west offset, with 'more east' being positive and 'more west' being negative.
The second return value represents north/south offset, with 'more south' being positive and 'more north' being negative.
This coordinate system agrees with the implementations Add<(i32, i32)> for RoomName
and Sub<(i32, i32)> for RoomName
.
impl Hash for RoomName
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
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 FromStr for RoomName
[src]
type Err = RoomNameParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, RoomNameParseError>
[src]
impl JsSerialize for RoomName
fn _into_js<'x>(&'x self) -> SerializedValue<'x>
impl TryFrom<Value> for RoomName
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
impl TryFrom<RoomName> for Value
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: RoomName) -> Result<Self, Self::Error>
impl<'_a> TryFrom<&'_a RoomName> for Value
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &'_a RoomName) -> Result<Self, Self::Error>
impl<'_a> TryFrom<&'_a mut RoomName> for Value
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &'_a mut RoomName) -> Result<Self, Self::Error>
impl JsSerializeOwned for RoomName
fn into_js_owned<'_a>(value: &'_a mut Option<Self>) -> SerializedValue<'_a>
impl<'_r> JsSerializeOwned for &'_r RoomName
fn into_js_owned<'_a>(value: &'_a mut Option<Self>) -> SerializedValue<'_a>
impl Serialize for RoomName
[src]
impl<'de> Deserialize<'de> for RoomName
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Auto Trait Implementations
impl Sync for RoomName
impl Send for RoomName
impl Unpin for RoomName
impl RefUnwindSafe for RoomName
impl UnwindSafe for RoomName
Blanket Implementations
impl<T, U> IntoExpectedType<U> for T where
U: FromExpectedType<T>,
[src]
U: FromExpectedType<T>,
fn into_expected_type(Self) -> Result<U, ConversionError>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,