Skip to main content

effect

Macro effect 

Source
macro_rules! effect {
    ($id:expr, $kind:expr, { $( $ev:ident $( ( $ord:expr ) )? => $fn:path ),* $(,)? }) => { ... };
    (@ord $o:expr) => { ... };
    (@ord) => { ... };
}
Expand description

Declarative effect builder (design §4.1). Expands to an Effect whose hooks is a &'static slice of EventHooks. Usable anywhere an Effect expression is expected (incl. the initializer of a const/static).

Syntax: effect!(<id expr>, <EffectType expr>, { <Event> [(<order>)] => <fn path>, ... })

  • <Event> is bare (e.g. DamagingHit) — it is qualified to $crate::battle::stack::event::Event::<Event> by the macro.
  • (<order>) is optional; omitted ⇒ u32::MAX (fires last).
  • <fn path> is any path to a HandlerFn (a zero-capture fn), e.g. my_handler::<P>.