pub struct TaskInfo {
pub name: String,
pub state: TaskState,
pub uptime: Duration,
pub created_at: Instant,
pub finished_at: Option<Instant>,
}
Expand description
Information about a running or completed task
Provides metadata about the task execution including timing, state, and lifecycle information.
§Examples
use tcrm_task::tasks::async_tokio::spawner::{TaskSpawner, TaskInfo};
use tcrm_task::tasks::config::TaskConfig;
#[tokio::main]
async fn main() {
let config = TaskConfig::new("cmd").args(["/C", "echo", "hello"]);
let spawner = TaskSpawner::new("test".to_string(), config);
let info: TaskInfo = spawner.get_task_info().await;
println!("Task {} is in state {:?}", info.name, info.state);
}
Fields§
§name: String
Name of the task
state: TaskState
Current execution state
uptime: Duration
How long the task has been running
created_at: Instant
When the task was created
finished_at: Option<Instant>
When the task finished (if completed)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskInfo
impl RefUnwindSafe for TaskInfo
impl Send for TaskInfo
impl Sync for TaskInfo
impl Unpin for TaskInfo
impl UnwindSafe for TaskInfo
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