Skip to main content

TriggerEngine

Struct TriggerEngine 

Source
pub struct TriggerEngine { /* private fields */ }
Expand description

Universal trigger engine — any event can start a workflow.

Implementations§

Source§

impl TriggerEngine

Source

pub fn new() -> Self

Source

pub fn create_trigger( &mut self, name: &str, workflow_id: &str, trigger_type: TriggerType, condition: Option<TriggerCondition>, debounce_ms: Option<u64>, ) -> WorkflowResult<String>

Create a new trigger.

Source

pub fn list_triggers(&self) -> Vec<&Trigger>

List all triggers.

Source

pub fn triggers_for_workflow(&self, workflow_id: &str) -> Vec<&Trigger>

List triggers for a specific workflow.

Source

pub fn set_enabled( &mut self, trigger_id: &str, enabled: bool, ) -> WorkflowResult<()>

Enable or disable a trigger.

Source

pub fn remove_trigger(&mut self, trigger_id: &str) -> WorkflowResult<Trigger>

Remove a trigger.

Source

pub fn record_activation( &mut self, trigger_id: &str, execution_id: &str, event_data: Value, condition_met: bool, ) -> WorkflowResult<()>

Record a trigger activation.

Source

pub fn activation_history(&self, trigger_id: &str) -> Vec<&TriggerActivation>

Get activation history for a trigger.

Source

pub fn test_condition( &self, trigger_id: &str, event_data: &Value, ) -> WorkflowResult<bool>

Test a trigger condition against sample event data.

Trait Implementations§

Source§

impl Default for TriggerEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.