pub struct TogglingTriggerCriteria<AC, DC> { /* private fields */ }Expand description
A pair of activation and deactivation criteria that can be bound to emitted events.
Implementations§
Source§impl<AC, DC> TogglingTriggerCriteria<AC, DC>where
AC: TriggerCriterion,
DC: TriggerCriterion,
impl<AC, DC> TogglingTriggerCriteria<AC, DC>where
AC: TriggerCriterion,
DC: TriggerCriterion,
Sourcepub fn new(activation_criterion: AC, deactivation_criterion: DC) -> Self
pub fn new(activation_criterion: AC, deactivation_criterion: DC) -> Self
Create a toggling trigger criteria pair that starts inactive and uses repeating mode.
Sourcepub fn initially_active(self) -> Self
pub fn initially_active(self) -> Self
Start the completed toggling trigger in the active state.
See TogglingTrigger::initially_active for the runtime semantics.
Sourcepub fn initially_inactive(self) -> Self
pub fn initially_inactive(self) -> Self
Start the completed toggling trigger in the inactive state.
This is the default state. See TogglingTrigger::initially_inactive for the runtime
semantics.
Sourcepub fn once(self) -> Self
pub fn once(self) -> Self
Run the completed toggling trigger through one active period and then disable it.
This sets the mode of the completed TogglingTrigger, not the mode of either component
criterion.
Sourcepub fn repeating(self) -> Self
pub fn repeating(self) -> Self
Keep the completed toggling trigger enabled after deactivation so it can activate again.
This is the default mode. This sets the mode of the completed TogglingTrigger, not the
mode of either component criterion.
Sourcepub fn emit_with<ActiveEv, InactiveEv, MakeActive, MakeInactive>(
self,
make_active_event: MakeActive,
make_inactive_event: MakeInactive,
) -> TogglingTrigger<AC, DC, ActiveEv, InactiveEv, MakeActive, MakeInactive>where
ActiveEv: IxaEvent,
InactiveEv: IxaEvent,
MakeActive: Fn(AC::Observation) -> ActiveEv + 'static,
MakeInactive: Fn(DC::Observation) -> InactiveEv + 'static,
pub fn emit_with<ActiveEv, InactiveEv, MakeActive, MakeInactive>(
self,
make_active_event: MakeActive,
make_inactive_event: MakeInactive,
) -> TogglingTrigger<AC, DC, ActiveEv, InactiveEv, MakeActive, MakeInactive>where
ActiveEv: IxaEvent,
InactiveEv: IxaEvent,
MakeActive: Fn(AC::Observation) -> ActiveEv + 'static,
MakeInactive: Fn(DC::Observation) -> InactiveEv + 'static,
Bind this pair of criteria to constructors for activation and deactivation events.
Sourcepub fn emit_values<ActiveEv, InactiveEv>(
self,
active_event: ActiveEv,
inactive_event: InactiveEv,
) -> TogglingTrigger<AC, DC, ActiveEv, InactiveEv, impl Fn(AC::Observation) -> ActiveEv, impl Fn(DC::Observation) -> InactiveEv>
pub fn emit_values<ActiveEv, InactiveEv>( self, active_event: ActiveEv, inactive_event: InactiveEv, ) -> TogglingTrigger<AC, DC, ActiveEv, InactiveEv, impl Fn(AC::Observation) -> ActiveEv, impl Fn(DC::Observation) -> InactiveEv>
Bind this pair of criteria to constant activation and deactivation event values.
Sourcepub fn emit_defaults<ActiveEv, InactiveEv>(
self,
) -> TogglingTrigger<AC, DC, ActiveEv, InactiveEv, impl Fn(AC::Observation) -> ActiveEv, impl Fn(DC::Observation) -> InactiveEv>
pub fn emit_defaults<ActiveEv, InactiveEv>( self, ) -> TogglingTrigger<AC, DC, ActiveEv, InactiveEv, impl Fn(AC::Observation) -> ActiveEv, impl Fn(DC::Observation) -> InactiveEv>
Bind this pair of criteria to default-valued activation and deactivation events.