pub struct Trigger<Event, Action> {
pub id_str: String,
pub condition: TriggerCondition<Event>,
pub actions: Vec<Action>,
}Expand description
A raw trigger.
Fields§
§id_str: StringA unique identifier of the trigger.
condition: TriggerCondition<Event>The condition for the trigger to trigger.
actions: Vec<Action>The actions the trigger executes when triggered.
Implementations§
Source§impl<Event, Action> Trigger<Event, Action>
impl<Event, Action> Trigger<Event, Action>
Sourcepub fn new(
id_str: String,
condition: TriggerCondition<Event>,
actions: Vec<Action>,
) -> Self
pub fn new( id_str: String, condition: TriggerCondition<Event>, actions: Vec<Action>, ) -> Self
Creates a new raw trigger.
Sourcepub fn compile<EventCompiler: Fn(Event) -> CompiledEvent, CompiledEvent: TriggerEvent, ActionCompiler: Fn(Action) -> CompiledEvent::Action>(
self,
event_compiler: &EventCompiler,
action_compiler: &ActionCompiler,
) -> CompiledTrigger<CompiledEvent>
pub fn compile<EventCompiler: Fn(Event) -> CompiledEvent, CompiledEvent: TriggerEvent, ActionCompiler: Fn(Action) -> CompiledEvent::Action>( self, event_compiler: &EventCompiler, action_compiler: &ActionCompiler, ) -> CompiledTrigger<CompiledEvent>
Compiles this trigger.
Events are compiled by the event compiler, and actions are compiled by the action compiler.
Trait Implementations§
Auto Trait Implementations§
impl<Event, Action> Freeze for Trigger<Event, Action>where
Event: Freeze,
impl<Event, Action> RefUnwindSafe for Trigger<Event, Action>where
Event: RefUnwindSafe,
Action: RefUnwindSafe,
impl<Event, Action> Send for Trigger<Event, Action>
impl<Event, Action> Sync for Trigger<Event, Action>
impl<Event, Action> Unpin for Trigger<Event, Action>
impl<Event, Action> UnwindSafe for Trigger<Event, Action>where
Event: UnwindSafe,
Action: UnwindSafe,
Blanket Implementations§
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