pub struct ReplacementHandler { /* private fields */ }Expand description
Struct-based replacement handler with loop prevention and optional agent access.
Mirrors Java ReplacementHandler class. The has_run set prevents infinite
loops when effects re-trigger themselves.
Usage:
ReplacementHandler::new().run(game, Some(agents), event)— with agent choiceapply_replacements(game, event)— free function wrapper (no agent, auto-selects first)
Implementations§
Source§impl ReplacementHandler
impl ReplacementHandler
pub fn new() -> Self
Sourcepub fn run(
&mut self,
game: &mut GameState,
agents: Option<&mut [Box<dyn PlayerAgent>]>,
runtime: Option<&mut ReplacementRuntime<'_>>,
event: &mut ReplacementEvent,
) -> ReplacementResult
pub fn run( &mut self, game: &mut GameState, agents: Option<&mut [Box<dyn PlayerAgent>]>, runtime: Option<&mut ReplacementRuntime<'_>>, event: &mut ReplacementEvent, ) -> ReplacementResult
Apply all applicable replacement effects to a game event.
Processes effects in CR 616 layer order: CantHappen → Control → Copy → Transform → Other.
When agents is Some and multiple effects match in the same layer,
the affected player’s agent is asked to choose via
choose_single_replacement_effect().
Mirrors Java ReplacementHandler.run(ReplacementType, Map<AbilityKey,Object>).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplacementHandler
impl RefUnwindSafe for ReplacementHandler
impl Send for ReplacementHandler
impl Sync for ReplacementHandler
impl Unpin for ReplacementHandler
impl UnsafeUnpin for ReplacementHandler
impl UnwindSafe for ReplacementHandler
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.