pub struct TaskInfo {
pub id: TaskId,
pub name: String,
pub state: TaskState,
pub created_at: Instant,
pub last_updated: Instant,
pub poll_count: u64,
pub total_run_time: Duration,
pub parent: Option<TaskId>,
pub location: Option<String>,
}Expand description
Information about a task
Fields§
§id: TaskIdUnique task identifier
name: StringHuman-readable task name
state: TaskStateCurrent state of the task
created_at: InstantWhen the task was created
last_updated: InstantWhen the task last changed state
poll_count: u64Number of times the task has been polled
total_run_time: DurationTotal time spent in running state
parent: Option<TaskId>Parent task ID, if any
location: Option<String>Source location (file:line)
Implementations§
Source§impl TaskInfo
impl TaskInfo
Sourcepub fn update_state(&mut self, new_state: TaskState)
pub fn update_state(&mut self, new_state: TaskState)
Update the task state
Sourcepub fn record_poll(&mut self, duration: Duration)
pub fn record_poll(&mut self, duration: Duration)
Record a poll
Sourcepub fn time_since_update(&self) -> Duration
pub fn time_since_update(&self) -> Duration
Get time since last update
Sourcepub fn with_parent(self, parent: TaskId) -> Self
pub fn with_parent(self, parent: TaskId) -> Self
Set the parent task
Sourcepub fn with_location(self, location: String) -> Self
pub fn with_location(self, location: String) -> Self
Set the source location
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more