pub struct Task {
pub id: TaskId,
pub name: Option<String>,
pub priority: TaskPriority,
pub state: TaskState,
pub action: RtObject,
pub dependencies: Vec<TaskId>,
pub dependents: Vec<TaskId>,
pub created_at: u64,
pub completed_at: Option<u64>,
}Expand description
A task represents a unit of work to be executed.
Fields§
§id: TaskIdUnique task identifier.
name: Option<String>Human-readable name (for debugging).
priority: TaskPriorityPriority.
state: TaskStateCurrent state.
action: RtObjectThe closure to execute (represented as an RtObject).
dependencies: Vec<TaskId>Dependencies (tasks that must complete before this one).
dependents: Vec<TaskId>Tasks that depend on this one (notified on completion).
created_at: u64Creation timestamp (nanoseconds).
completed_at: Option<u64>Completion timestamp (nanoseconds).
Implementations§
Source§impl Task
impl Task
Sourcepub fn with_priority(self, priority: TaskPriority) -> Self
pub fn with_priority(self, priority: TaskPriority) -> Self
Set the priority.
Sourcepub fn depends_on(self, dep: TaskId) -> Self
pub fn depends_on(self, dep: TaskId) -> Self
Add a dependency.
Sourcepub fn dependencies_satisfied(&self, completed: &[TaskId]) -> bool
pub fn dependencies_satisfied(&self, completed: &[TaskId]) -> bool
Check if all dependencies are satisfied.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
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