pub struct TaskMetadata {
pub id: u64,
pub created_at: Instant,
pub started_at: Option<Instant>,
pub completed_at: Option<Instant>,
pub worker_id: Option<usize>,
pub priority: Priority,
pub cancelled: bool,
}Expand description
Task metadata for tracking and debugging
Fields§
§id: u64Executor-unique task identifier.
created_at: InstantInstant the task was accepted.
started_at: Option<Instant>Instant the body started, once running.
completed_at: Option<Instant>Instant the body finished, once complete.
worker_id: Option<usize>Worker that executed the body, once assigned.
priority: PriorityPriority the task was spawned with.
cancelled: boolTrue when the task ended without producing a result: a cancel request was honored before the body ran, or the task was discarded unfinished.
Implementations§
Source§impl TaskMetadata
impl TaskMetadata
Sourcepub fn mark_started(&mut self, worker_id: usize)
pub fn mark_started(&mut self, worker_id: usize)
Mark task as started
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark task as completed
Sourcepub fn execution_duration(&self) -> Option<Duration>
pub fn execution_duration(&self) -> Option<Duration>
Get task execution duration
Trait Implementations§
Source§impl Clone for TaskMetadata
impl Clone for TaskMetadata
Auto Trait Implementations§
impl Freeze for TaskMetadata
impl RefUnwindSafe for TaskMetadata
impl Send for TaskMetadata
impl Sync for TaskMetadata
impl Unpin for TaskMetadata
impl UnsafeUnpin for TaskMetadata
impl UnwindSafe for TaskMetadata
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