Skip to main content

EffectState

Struct EffectState 

Source
pub struct EffectState<P: EffectProvider + ?Sized> {
    pub id: EffectId,
    pub host: BattlerRef,
    pub effect_order: u64,
    pub kind: P::EffectStateKind,
}
Expand description

One live effect’s mutable per-instance state, held in an arena keyed by id (design §3.1). kind is the game’s typed counter enum, so the compiler checks every counter (no positional slot bag).

Fields§

§id: EffectId

The effect id (arena key; the arena is kept sorted for binary search).

§host: BattlerRef

The battler this effect is attached to.

Kept BattlerRef (not EffectHost) so every existing struct-literal constructor compiles unchanged (see EffectHost’s non-breaking note). Project to the 3-way scope via EffectState::host_scope.

§effect_order: u64

Monotonic creation counter — the final deterministic tiebreak in the comparator (design §1.3), stamped at creation, consumes NO rng.

§kind: P::EffectStateKind

The game’s typed counter state.

Implementations§

Source§

impl<P: EffectProvider + ?Sized> EffectState<P>

Source

pub fn host_scope(&self) -> EffectHost

The 3-way host scope of this effect (design §3.1). Arena effects are always battler-hosted today, so this returns EffectHost::Battler; the method is the routing seam the driver uses so a future side/field-hosted state path can branch on scope without callers caring how host is stored.

Trait Implementations§

Source§

impl<P: EffectProvider + ?Sized> Clone for EffectState<P>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.