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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Activity
impl<'de> Deserialize<'de> for Activity
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 Activity
impl RefUnwindSafe for Activity
impl Send for Activity
impl Sync for Activity
impl Unpin for Activity
impl UnsafeUnpin for Activity
impl UnwindSafe for Activity
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