Skip to main content

Workflow

Struct Workflow 

Source
pub struct Workflow {
Show 14 fields pub id: String, pub name: String, pub priority: u32, pub description: Option<String>, pub condition: Value, pub condition_index: Option<usize>, pub tasks: Vec<Task>, pub continue_on_error: bool, pub channel: String, pub version: u32, pub status: WorkflowStatus, pub tags: Vec<String>, pub created_at: Option<DateTime<Utc>>, pub updated_at: Option<DateTime<Utc>>,
}
Expand description

Workflow represents a collection of tasks that execute sequentially (also known as a Rule in rules-engine terminology).

Conditions are evaluated against the full message context, including data, metadata, and temp_data fields.

Fields§

§id: String§name: String§priority: u32§description: Option<String>§condition: Value§condition_index: Option<usize>§tasks: Vec<Task>§continue_on_error: bool§channel: String

Channel for routing (default: “default”)

§version: u32

Version number for rule versioning (default: 1)

§status: WorkflowStatus

Workflow status — Active, Paused, or Archived (default: Active)

§tags: Vec<String>

Tags for categorization and filtering

§created_at: Option<DateTime<Utc>>

Creation timestamp

§updated_at: Option<DateTime<Utc>>

Last update timestamp

Implementations§

Source§

impl Workflow

Source

pub fn new() -> Self

Source

pub fn rule(id: &str, name: &str, condition: Value, tasks: Vec<Task>) -> Self

Create a workflow (rule) with a condition and tasks.

This is a convenience constructor for the IFTTT-style rules engine pattern: IF condition THEN execute tasks.

§Arguments
  • id - Unique identifier for the rule
  • name - Human-readable name
  • condition - JSONLogic condition evaluated against the full context (data, metadata, temp_data)
  • tasks - Actions to execute when the condition is met
Source

pub fn from_json(json_str: &str) -> Result<Self>

Load workflow from JSON string

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>

Load workflow from JSON file

Source

pub fn validate(&self) -> Result<()>

Validate the workflow structure

Trait Implementations§

Source§

impl Clone for Workflow

Source§

fn clone(&self) -> Workflow

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Workflow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Workflow

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Workflow

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,