pub struct Task {
pub id: String,
pub name: String,
pub category: String,
pub priority: i32,
pub deadline: Option<i64>,
pub release_time: Option<i64>,
pub activities: Vec<Activity>,
pub attributes: HashMap<String, String>,
}Expand description
A task (job) to be scheduled.
Contains one or more activities and scheduling metadata (priority, deadlines). Activities within a task may have precedence constraints forming a DAG.
§Time Representation
All times are in milliseconds relative to a scheduling epoch (t=0). The consumer defines what t=0 means (e.g., shift start, midnight UTC).
Fields§
§id: StringUnique task identifier.
name: StringHuman-readable name.
category: StringTask category (for transition matrix lookups and grouping).
priority: i32Scheduling priority (higher = more important).
deadline: Option<i64>Latest completion time (ms). None = no deadline.
release_time: Option<i64>Earliest start time (ms). None = available immediately.
activities: Vec<Activity>Activities (operations) that compose this task.
attributes: HashMap<String, String>Domain-specific key-value metadata.
Implementations§
Source§impl Task
impl Task
Sourcepub fn with_category(self, category: impl Into<String>) -> Self
pub fn with_category(self, category: impl Into<String>) -> Self
Sets the task category.
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Sets the scheduling priority.
Sourcepub fn with_deadline(self, deadline_ms: i64) -> Self
pub fn with_deadline(self, deadline_ms: i64) -> Self
Sets the deadline (latest completion time in ms).
Sourcepub fn with_release_time(self, release_ms: i64) -> Self
pub fn with_release_time(self, release_ms: i64) -> Self
Sets the release time (earliest start time in ms).
Sourcepub fn with_activity(self, activity: Activity) -> Self
pub fn with_activity(self, activity: Activity) -> Self
Adds an activity to this task.
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds a domain-specific attribute.
Sourcepub fn total_duration_ms(&self) -> i64
pub fn total_duration_ms(&self) -> i64
Total processing duration across all activities (ms).
Sourcepub fn has_activities(&self) -> bool
pub fn has_activities(&self) -> bool
Whether this task has any activities.
Sourcepub fn activity_count(&self) -> usize
pub fn activity_count(&self) -> usize
Number of activities.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more