Skip to main content

RulesProvider

Trait RulesProvider 

Source
pub trait RulesProvider: EffectProvider {
    type Bindings: RuleBindings<Self>;

    // Required methods
    fn compiled(&self) -> &CompiledRuleset;
    fn bindings(&self) -> &Self::Bindings;
    fn rules_host() -> Option<&'static RulesHost<Self>>
       where Self: Sized;
}
Expand description

The game-side bridge trait (doc 11 §2.2 Option A) — extends EffectProvider with the two things the zero-capture interpret fn needs but cannot capture: the compiled op-list registry and the game binding. This adds NO method to any engine trait — it is an additive game-side super-trait, so the engine is untouched.

Required Associated Types§

Source

type Bindings: RuleBindings<Self>

The game binding resolving interned indices ↔ concrete P::Stat/P::Status and supplying the chart fold.

Required Methods§

Source

fn compiled(&self) -> &CompiledRuleset

The compiled ruleset (the side registry the interpreter reads by source_effect). Typically a &'static built once via OnceLock.

Source

fn bindings(&self) -> &Self::Bindings

The game binding instance.

Source

fn rules_host() -> Option<&'static RulesHost<Self>>
where Self: Sized,

Read the provider from ctx for the interpreter. The interpreter only has &mut BattleCtx, which does NOT carry &P (the engine’s borrow discipline). A game whose chart/registry is a &'static (the common case) returns it here without touching ctx; the default points at that static. Returns None if no static is installed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§