pub struct TaskHandle {
pub id: TaskId,
pub name: String,
/* private fields */
}Expand description
任务句柄
用于管理和查询任务状态。
Fields§
§id: TaskId任务 ID
name: String任务名称
Implementations§
Source§impl TaskHandle
impl TaskHandle
Sourcepub fn execution_count(&self) -> u64
pub fn execution_count(&self) -> u64
获取执行次数
Sourcepub async fn last_execution(&self) -> Option<DateTime<Utc>>
pub async fn last_execution(&self) -> Option<DateTime<Utc>>
获取最后执行时间
Sourcepub async fn last_error(&self) -> Option<String>
pub async fn last_error(&self) -> Option<String>
获取最后错误信息
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
检查任务是否已取消
Sourcepub async fn record_execution(&self)
pub async fn record_execution(&self)
记录执行
Sourcepub async fn record_error(&self, error: String)
pub async fn record_error(&self, error: String)
记录错误
Trait Implementations§
Source§impl Clone for TaskHandle
impl Clone for TaskHandle
Source§fn clone(&self) -> TaskHandle
fn clone(&self) -> TaskHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TaskHandle
impl !RefUnwindSafe for TaskHandle
impl Send for TaskHandle
impl Sync for TaskHandle
impl Unpin for TaskHandle
impl UnsafeUnpin for TaskHandle
impl !UnwindSafe for TaskHandle
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