#[repr(u8)]
pub enum StructureType {
Show 21 variants
Spawn,
Extension,
Road,
Wall,
Rampart,
KeeperLair,
Portal,
Controller,
Link,
Storage,
Tower,
Observer,
PowerBank,
PowerSpawn,
Extractor,
Lab,
Terminal,
Container,
Nuker,
Factory,
InvaderCore,
}
Expand description
Translates STRUCTURE_*
constants.
Note: This constant’s TryFrom<Value>
, Serialize
and Deserialize
implementations only operate on made-up integer constants. If you’re ever
using these impls manually, use the __structure_type_num_to_str
and
__structure_type_str_to_num
JavaScript functions,
FromStr
or StructureType::deserialize_from_str
.
See the module-level documentation for more details.
Variants
Spawn
Extension
Road
Wall
Rampart
KeeperLair
Portal
Controller
Link
Storage
Tower
Observer
PowerBank
PowerSpawn
Extractor
Lab
Terminal
Container
Nuker
Factory
InvaderCore
Implementations
sourceimpl StructureType
impl StructureType
sourcepub fn construction_cost(self) -> Option<u32>
pub fn construction_cost(self) -> Option<u32>
Translates the CONSTRUCTION_COST
constant.
sourcepub fn controller_structures(self, current_rcl: u32) -> u32
pub fn controller_structures(self, current_rcl: u32) -> u32
Translates the CONTROLLER_STRUCTURES
constant
sourcepub fn initial_hits(self) -> Option<u32>
pub fn initial_hits(self) -> Option<u32>
Translates the *_HITS
constants, initial hits for structures
sourcepub fn deserialize_from_str<'de, D: Deserializer<'de>>(
d: D
) -> Result<Self, D::Error>
pub fn deserialize_from_str<'de, D: Deserializer<'de>>(
d: D
) -> Result<Self, D::Error>
Helper function for deserializing from a string rather than a fake integer value.
Trait Implementations
sourceimpl Clone for StructureType
impl Clone for StructureType
sourcefn clone(&self) -> StructureType
fn clone(&self) -> StructureType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StructureType
impl Debug for StructureType
sourceimpl<'de> Deserialize<'de> for StructureType
impl<'de> Deserialize<'de> for StructureType
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for StructureType
impl Display for StructureType
sourceimpl FromStr for StructureType
impl FromStr for StructureType
sourceimpl Hash for StructureType
impl Hash for StructureType
sourceimpl PartialEq<StructureType> for StructureType
impl PartialEq<StructureType> for StructureType
sourcefn eq(&self, other: &StructureType) -> bool
fn eq(&self, other: &StructureType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl Serialize for StructureType
impl Serialize for StructureType
sourceimpl TryFrom<Value> for StructureType
impl TryFrom<Value> for StructureType
impl Copy for StructureType
impl Eq for StructureType
impl StructuralEq for StructureType
impl StructuralPartialEq for StructureType
Auto Trait Implementations
impl RefUnwindSafe for StructureType
impl Send for StructureType
impl Sync for StructureType
impl Unpin for StructureType
impl UnwindSafe for StructureType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> IntoExpectedType<U> for Twhere
U: FromExpectedType<T>,
impl<T, U> IntoExpectedType<U> for Twhere
U: FromExpectedType<T>,
sourcefn into_expected_type(self) -> Result<U, ConversionError>
fn into_expected_type(self) -> Result<U, ConversionError>
Casts this value as the target type, making the assumption that the types are correct. Read more