pub trait CardTraitIrOwner {
type Ir;
// Required methods
fn ir(&self) -> &Self::Ir;
fn card_trait_requirements(&self) -> &CardTraitRequirementsIr;
// Provided method
fn meets_card_trait_requirements(
&self,
game: &GameState,
source: &Card,
svar_source: &dyn HasSVars,
) -> bool { ... }
}Expand description
Runtime objects that have a lowered card-trait IR.
This is the Rust equivalent of Java subclasses inheriting common
CardTraitBase behavior while carrying their own concrete data. It is not
limited to CardTrait implementors because SpellAbility also owns a
lowered IR in Rust.
The associated type keeps each owner tied to its specific IR (TriggerIr,
StaticAbilityIr, ReplacementEffectIr, SpellAbilityIr, …). The
requirement view is exposed directly here so shared checks only need this
one trait.
Required Associated Types§
Required Methods§
fn ir(&self) -> &Self::Ir
fn card_trait_requirements(&self) -> &CardTraitRequirementsIr
Provided Methods§
fn meets_card_trait_requirements( &self, game: &GameState, source: &Card, svar_source: &dyn HasSVars, ) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".