pub trait Unit: Send + Sync {
Show 21 methods
// Required methods
fn id(&self) -> UnitId;
fn kind(&self) -> UnitKind;
fn building(&self) -> BuildingId;
fn score(&self) -> Score;
fn stats(&self) -> &UnitStats;
fn power(&self) -> Power;
fn attack(&self) -> AttackPower;
fn defense(&self) -> DefensePower;
fn ranged_debuff(&self) -> RangedDebuff;
fn speed(&self, config: &WorldConfig) -> Speed;
fn haul(&self) -> Haul;
fn chunk(&self) -> &UnitChunk;
fn infrastructure_requirements(&self) -> &InfrastructureRequirements;
// Provided methods
fn is_cavalry(&self) -> bool { ... }
fn is_infantry(&self) -> bool { ... }
fn is_ranged(&self) -> bool { ... }
fn is_offensive(&self) -> bool { ... }
fn is_defensive(&self) -> bool { ... }
fn is_academy_unit(&self) -> bool { ... }
fn is_stable_unit(&self) -> bool { ... }
fn is_workshop_unit(&self) -> bool { ... }
}Required Methods§
fn id(&self) -> UnitId
fn kind(&self) -> UnitKind
Sourcefn building(&self) -> BuildingId
fn building(&self) -> BuildingId
Building where the unit is recruited.
fn score(&self) -> Score
fn stats(&self) -> &UnitStats
fn power(&self) -> Power
fn attack(&self) -> AttackPower
fn defense(&self) -> DefensePower
fn ranged_debuff(&self) -> RangedDebuff
fn speed(&self, config: &WorldConfig) -> Speed
fn haul(&self) -> Haul
fn chunk(&self) -> &UnitChunk
Sourcefn infrastructure_requirements(&self) -> &InfrastructureRequirements
fn infrastructure_requirements(&self) -> &InfrastructureRequirements
Building levels required to recruit the unit.
Provided Methods§
fn is_cavalry(&self) -> bool
fn is_infantry(&self) -> bool
fn is_ranged(&self) -> bool
fn is_offensive(&self) -> bool
fn is_defensive(&self) -> bool
fn is_academy_unit(&self) -> bool
fn is_stable_unit(&self) -> bool
fn is_workshop_unit(&self) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".