Skip to main content

TaskMetadata

Struct TaskMetadata 

Source
pub struct TaskMetadata {
    pub id: TaskId,
    pub state: TaskState,
    pub created_at: u64,
    pub last_wake_at: u64,
    pub last_run_at: Option<u64>,
    pub run_count: u64,
}
Expand description

任务元数据

Fields§

§id: TaskId

任务ID

§state: TaskState

任务状态

§created_at: u64

创建时间

§last_wake_at: u64

最后唤醒时间

§last_run_at: Option<u64>

最后执行时间

§run_count: u64

执行次数

Implementations§

Source§

impl TaskMetadata

Source

pub fn new(id: TaskId) -> Self

创建新的任务元数据

Source

pub fn is_expired(&self, timeout_ms: u64) -> bool

检查任务是否超过指定时间未执行

Source

pub fn update_execution(&mut self)

更新执行时间

Source

pub fn mark_woken(&mut self)

标记任务为已唤醒

Source

pub fn mark_completed(&mut self)

标记任务为已完成

Trait Implementations§

Source§

impl Debug for TaskMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Background for T

Source§

fn bg(self, rgb: Rgb<u8>) -> WithBackground<T>

Adds the given background color
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Foreground for T

Source§

fn fg(self, rgb: Rgb<u8>) -> WithForeground<T>

Adds the given foreground color
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.