Skip to main content

Task

Struct Task 

Source
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: String

Unique task identifier.

§name: String

Human-readable name.

§category: String

Task category (for transition matrix lookups and grouping).

§priority: i32

Scheduling 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

Source

pub fn new(id: impl Into<String>) -> Self

Creates a new task with the given ID.

Source

pub fn with_name(self, name: impl Into<String>) -> Self

Sets the task name.

Source

pub fn with_category(self, category: impl Into<String>) -> Self

Sets the task category.

Source

pub fn with_priority(self, priority: i32) -> Self

Sets the scheduling priority.

Source

pub fn with_deadline(self, deadline_ms: i64) -> Self

Sets the deadline (latest completion time in ms).

Source

pub fn with_release_time(self, release_ms: i64) -> Self

Sets the release time (earliest start time in ms).

Source

pub fn with_activity(self, activity: Activity) -> Self

Adds an activity to this task.

Source

pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self

Adds a domain-specific attribute.

Source

pub fn total_duration_ms(&self) -> i64

Total processing duration across all activities (ms).

Source

pub fn has_activities(&self) -> bool

Whether this task has any activities.

Source

pub fn activity_count(&self) -> usize

Number of activities.

Trait Implementations§

Source§

impl Clone for Task

Source§

fn clone(&self) -> Task

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Task

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Task

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Task

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,