pub trait WorkflowLike:
Send
+ Sync
+ Debug
+ 'static {
Show 13 methods
// Required methods
fn version(&self) -> u32;
fn minor_version(&self) -> u32;
fn reference(&self) -> &Reference;
fn path(&self) -> &Path;
fn get_row(&self, index: usize) -> Option<Rule>;
fn get_rule(&self, identifier: &str) -> Option<Rule>;
fn contains(&self, identifier: &str) -> bool;
fn has_rule(&self, index: usize) -> bool;
fn rule_count(&self) -> usize;
fn rule_rows(&self) -> usize;
fn iter_rows<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a Option<Rule>> + 'a>;
fn iter_rules<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Rule> + 'a>;
fn as_any(&self) -> &dyn Any;
}Expand description
The central trait for interacting with workflow content.
This trait defines the interface for workflow management operations.
It is designed to be thread-safe (Send + Sync) to support concurrent access
in agentic workflow applications.
§Concurrency Guarantees
Send: The type can be safely sent (moved) to another threadSync: The type can be safely shared (&T) between threadsArc<T>requires its contained typeTto beSend + Sync
§Implementation Notes
The WorkflowLike trait provides both read-only and mutable operations,
with the mutable operations typically implemented through interior mutability
patterns to maintain thread safety.
§Examples
use aimx::{WorkflowLike, Workflow};
use std::sync::Arc;
// Create a workflow and wrap it in an Arc for thread-safe sharing
let workflow = Arc::new(Workflow::new());
// Multiple threads can safely read from the workflow
let workflow_clone = Arc::clone(&workflow);
std::thread::spawn(move || {
println!("Workflow version: {}", workflow_clone.version());
});Required Methods§
Sourcefn version(&self) -> u32
fn version(&self) -> u32
Returns the major version (epoch) of the workflow.
The epoch represents major structural changes to the workflow. Increments when significant changes are made that require a new version.
Sourcefn minor_version(&self) -> u32
fn minor_version(&self) -> u32
Returns the minor version (partial) of the workflow.
The partial represents incremental updates within the same epoch. Increments for minor changes that don’t require a new major version.
Sourcefn reference(&self) -> &Reference
fn reference(&self) -> &Reference
Returns the reference identifier for this workflow.
The reference uniquely identifies the workflow within the workspace.
Sourcefn path(&self) -> &Path
fn path(&self) -> &Path
Returns the file system path to the workflow’s AIM file.
This path points to the .aim file that stores the workflow content.
Sourcefn rule_count(&self) -> usize
fn rule_count(&self) -> usize
Returns the number of rules in the workflow.
This counts only the actual rules, excluding empty rows.
Sourcefn rule_rows(&self) -> usize
fn rule_rows(&self) -> usize
Returns the total number of rows in the workflow.
This includes both rules and empty rows.
Sourcefn iter_rows<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Option<Rule>> + 'a>
fn iter_rows<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Option<Rule>> + 'a>
Returns an iterator over all rows.
The iterator yields &Option<Rule> items, including empty rows.
Use this when you need to preserve the exact row structure.
Sourcefn iter_rules<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Rule> + 'a>
fn iter_rules<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Rule> + 'a>
Returns an iterator over all rules.
The iterator yields &Rule items, skipping empty rows.
Use this when you only need the actual rules.