pub struct TaskManager { /* private fields */ }Expand description
Manages a tree of tasks with dependencies
Implementations§
Source§impl TaskManager
impl TaskManager
Sourcepub async fn add_dependency(
&self,
task_id: &str,
depends_on: &str,
) -> Result<()>
pub async fn add_dependency( &self, task_id: &str, depends_on: &str, ) -> Result<()>
Add a dependency between tasks
Sourcepub async fn can_start(&self, task_id: &str) -> Result<bool, Vec<String>>
pub async fn can_start(&self, task_id: &str) -> Result<bool, Vec<String>>
Check if a task can be started (all dependencies are complete/skipped) Returns Ok(true) if task can start, or Err with list of blocking task IDs
Sourcepub async fn remove_dependency(
&self,
task_id: &str,
depends_on: &str,
) -> Result<()>
pub async fn remove_dependency( &self, task_id: &str, depends_on: &str, ) -> Result<()>
Remove a dependency between tasks
Sourcepub async fn unblock_dependents(&self, completed_task_id: &str) -> Result<()>
pub async fn unblock_dependents(&self, completed_task_id: &str) -> Result<()>
Unblock tasks that depend on a completed/skipped task
Source§impl TaskManager
impl TaskManager
Sourcepub async fn get_ready_tasks(&self) -> Vec<Task>
pub async fn get_ready_tasks(&self) -> Vec<Task>
Get all tasks ready to execute (no incomplete dependencies)
Sourcepub async fn get_root_tasks(&self) -> Vec<Task>
pub async fn get_root_tasks(&self) -> Vec<Task>
Get all root tasks (tasks without parents)
Sourcepub async fn get_task_tree(&self, root_id: Option<&str>) -> Vec<Task>
pub async fn get_task_tree(&self, root_id: Option<&str>) -> Vec<Task>
Get task tree starting from a task (or all roots if None)
Sourcepub async fn get_all_tasks(&self) -> Vec<Task>
pub async fn get_all_tasks(&self) -> Vec<Task>
Get all tasks
Sourcepub async fn get_tasks_by_status(&self, status: TaskStatus) -> Vec<Task>
pub async fn get_tasks_by_status(&self, status: TaskStatus) -> Vec<Task>
Get tasks by status
Sourcepub async fn get_task_time_info(&self, task_id: &str) -> Option<TaskTimeInfo>
pub async fn get_task_time_info(&self, task_id: &str) -> Option<TaskTimeInfo>
Get time tracking info for a task
Sourcepub async fn get_time_stats(&self) -> TimeStats
pub async fn get_time_stats(&self) -> TimeStats
Get time statistics for all tasks
Sourcepub async fn get_progress(&self, task_id: &str) -> f64
pub async fn get_progress(&self, task_id: &str) -> f64
Calculate progress percentage (0.0 to 1.0) for a task For tasks with children, this is based on completed children For leaf tasks, returns 1.0 if completed, 0.5 if in progress, 0.0 otherwise
Sourcepub async fn get_overall_progress(&self) -> f64
pub async fn get_overall_progress(&self) -> f64
Get overall progress for all tasks
Sourcepub async fn get_average_duration(&self) -> Option<i64>
pub async fn get_average_duration(&self) -> Option<i64>
Get average task duration in seconds (from completed tasks)
Sourcepub async fn estimate_remaining_time(&self) -> Option<i64>
pub async fn estimate_remaining_time(&self) -> Option<i64>
Estimate remaining time in seconds based on average duration
Sourcepub async fn format_tree(&self) -> String
pub async fn format_tree(&self) -> String
Format task tree as indented text for display
Source§impl TaskManager
impl TaskManager
Sourcepub async fn update_status(
&self,
task_id: &str,
status: TaskStatus,
summary: Option<String>,
) -> Result<()>
pub async fn update_status( &self, task_id: &str, status: TaskStatus, summary: Option<String>, ) -> Result<()>
Update task status
Sourcepub async fn start_task(&self, task_id: &str) -> Result<()>
pub async fn start_task(&self, task_id: &str) -> Result<()>
Mark a task as started
Sourcepub async fn complete_task(&self, task_id: &str, summary: String) -> Result<()>
pub async fn complete_task(&self, task_id: &str, summary: String) -> Result<()>
Mark a task as completed
Sourcepub async fn fail_task(&self, task_id: &str, error: String) -> Result<()>
pub async fn fail_task(&self, task_id: &str, error: String) -> Result<()>
Mark a task as failed
Source§impl TaskManager
impl TaskManager
Sourcepub async fn create_task(
&self,
description: String,
parent_id: Option<String>,
priority: TaskPriority,
) -> Result<String>
pub async fn create_task( &self, description: String, parent_id: Option<String>, priority: TaskPriority, ) -> Result<String>
Create a new task
Sourcepub async fn add_subtask(
&self,
parent_id: String,
description: String,
) -> Result<String>
pub async fn add_subtask( &self, parent_id: String, description: String, ) -> Result<String>
Add a subtask to an existing task
Sourcepub async fn load_tasks(&self, tasks_to_load: Vec<Task>)
pub async fn load_tasks(&self, tasks_to_load: Vec<Task>)
Load tasks from storage
Sourcepub async fn export_tasks(&self) -> Vec<Task>
pub async fn export_tasks(&self) -> Vec<Task>
Export all tasks for persistence
Trait Implementations§
Source§impl Clone for TaskManager
impl Clone for TaskManager
Source§fn clone(&self) -> TaskManager
fn clone(&self) -> TaskManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more