pub struct Activity {
pub id: String,
pub task_id: String,
pub sequence: i32,
pub duration: ActivityDuration,
pub resource_requirements: Vec<ResourceRequirement>,
pub predecessors: Vec<String>,
pub splittable: bool,
pub min_split_ms: i64,
pub attributes: HashMap<String, String>,
}Expand description
An activity (operation) to be scheduled.
Represents a single processing step that requires one or more resources for a specified duration. Activities within a task are linked by precedence constraints.
Fields§
§id: StringUnique activity identifier.
task_id: StringParent task identifier.
sequence: i32Position within the task (0-indexed).
duration: ActivityDurationTime required to complete this activity.
resource_requirements: Vec<ResourceRequirement>Resources needed (type + quantity + candidates).
predecessors: Vec<String>IDs of activities that must complete before this one starts.
splittable: boolWhether this activity can be preempted and resumed later.
min_split_ms: i64Minimum duration (ms) of each split segment.
attributes: HashMap<String, String>Domain-specific metadata.
Implementations§
Source§impl Activity
impl Activity
Sourcepub fn new(
id: impl Into<String>,
task_id: impl Into<String>,
sequence: i32,
) -> Self
pub fn new( id: impl Into<String>, task_id: impl Into<String>, sequence: i32, ) -> Self
Creates a new activity.
Sourcepub fn with_duration(self, duration: ActivityDuration) -> Self
pub fn with_duration(self, duration: ActivityDuration) -> Self
Sets the duration.
Sourcepub fn with_process_time(self, process_ms: i64) -> Self
pub fn with_process_time(self, process_ms: i64) -> Self
Sets the processing time (setup=0, teardown=0).
Sourcepub fn with_requirement(self, req: ResourceRequirement) -> Self
pub fn with_requirement(self, req: ResourceRequirement) -> Self
Adds a resource requirement.
Sourcepub fn with_predecessor(self, predecessor_id: impl Into<String>) -> Self
pub fn with_predecessor(self, predecessor_id: impl Into<String>) -> Self
Adds a predecessor activity ID.
Sourcepub fn with_splitting(self, min_split_ms: i64) -> Self
pub fn with_splitting(self, min_split_ms: i64) -> Self
Enables preemption with a minimum split size.
Sourcepub fn candidate_resources(&self) -> Vec<&str>
pub fn candidate_resources(&self) -> Vec<&str>
Returns all candidate resource IDs across all requirements.