pub struct TaskManager { /* private fields */ }Expand description
Manages all tasks across sessions.
Implementations§
Source§impl TaskManager
impl TaskManager
Sourcepub async fn create(
&self,
kind: TaskKind,
session_key: Option<String>,
) -> TaskHandle
pub async fn create( &self, kind: TaskKind, session_key: Option<String>, ) -> TaskHandle
Create a new task and return its handle.
Sourcepub async fn for_session(&self, session_key: &str) -> Vec<Task>
pub async fn for_session(&self, session_key: &str) -> Vec<Task>
Get tasks for a specific session.
Sourcepub async fn foreground_task(&self, session_key: &str) -> Option<Task>
pub async fn foreground_task(&self, session_key: &str) -> Option<Task>
Get the foreground task for a session.
Sourcepub async fn set_foreground(&self, id: TaskId) -> Result<(), String>
pub async fn set_foreground(&self, id: TaskId) -> Result<(), String>
Set a task as the foreground task for its session.
Sourcepub async fn update_status(&self, id: TaskId, new_status: TaskStatus)
pub async fn update_status(&self, id: TaskId, new_status: TaskStatus)
Update a task’s status.
Sourcepub async fn set_description(
&self,
id: TaskId,
description: &str,
) -> Result<(), String>
pub async fn set_description( &self, id: TaskId, description: &str, ) -> Result<(), String>
Set task description.
Sourcepub async fn send_output(&self, id: TaskId, output: TaskOutput)
pub async fn send_output(&self, id: TaskId, output: TaskOutput)
Send output for a task.
Sourcepub async fn cleanup_old(&self, max_age: Duration)
pub async fn cleanup_old(&self, max_age: Duration)
Cleanup completed/cancelled tasks older than the given duration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskManager
impl !RefUnwindSafe for TaskManager
impl Send for TaskManager
impl Sync for TaskManager
impl Unpin for TaskManager
impl UnsafeUnpin for TaskManager
impl !UnwindSafe for TaskManager
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