pub struct TaskExecutor { /* private fields */ }
Expand description
Handles the execution of tasks with their associated functions
The TaskExecutor
is responsible for:
- Executing built-in functions (map, validation)
- Executing custom async function handlers
- Managing function registry
- Handling task-level error recovery
Implementations§
Source§impl TaskExecutor
impl TaskExecutor
Sourcepub fn new(
task_functions: Arc<HashMap<String, Box<dyn AsyncFunctionHandler + Send + Sync>>>,
executor: Arc<InternalExecutor>,
datalogic: Arc<DataLogic>,
) -> Self
pub fn new( task_functions: Arc<HashMap<String, Box<dyn AsyncFunctionHandler + Send + Sync>>>, executor: Arc<InternalExecutor>, datalogic: Arc<DataLogic>, ) -> Self
Create a new TaskExecutor
Sourcepub async fn execute(
&self,
task: &Task,
message: &mut Message,
) -> Result<(usize, Vec<Change>)>
pub async fn execute( &self, task: &Task, message: &mut Message, ) -> Result<(usize, Vec<Change>)>
Execute a single task
This method:
- Determines the function type (built-in or custom)
- Executes the appropriate handler
- Returns the status code and changes for audit trail
§Arguments
task
- The task to executemessage
- The message being processed
§Returns
Result<(usize, Vec<Change>)>
- Status code and changes, or error
Sourcepub fn has_function(&self, name: &str) -> bool
pub fn has_function(&self, name: &str) -> bool
Check if a function handler exists
Sourcepub fn custom_function_count(&self) -> usize
pub fn custom_function_count(&self) -> usize
Get the count of registered custom functions
Auto Trait Implementations§
impl Freeze for TaskExecutor
impl !RefUnwindSafe for TaskExecutor
impl Send for TaskExecutor
impl Sync for TaskExecutor
impl Unpin for TaskExecutor
impl !UnwindSafe for TaskExecutor
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