ConstraintType#
The scheduling constraint of a task. It's the type of TaskData::constraint_type and TaskUpdate::constraint_type, and conflicts report it in Conflict::ConstraintViolation. Constraints take effect only when SchedulingConfig::apply_constraints is true.
Declaration#
With the serde feature, ConstraintType implements Serialize and Deserialize and uses the lowercase names ("asap", "snet", ...).
Variants#
| Variant | Description |
|---|---|
Asap |
As soon as possible. Places the task as early as its dependencies allow; no date. |
Alap |
As late as possible. Places the task as late as its dependencies allow; no date. |
Snet |
Start no earlier than the constraint date. |
Snlt |
Start no later than the constraint date. |
Fnet |
Finish no earlier than the constraint date. |
Fnlt |
Finish no later than the constraint date. |
Mso |
Must start on the constraint date. |
Mfo |
Must finish on the constraint date. |
All variants except Asap and Alap are dated: they need a constraint_date on the task. See TaskData.
Methods#
parse#
Parses a constraint name. Matching ignores case, so "SNET" and "snet" both give ConstraintType::Snet.
Parameters
| Name | Type | Description |
|---|---|---|
s |
&str |
One of asap, alap, snet, snlt, fnet, fnlt, mso, mfo, in any case. |
Returns - Some(ConstraintType), or None for any other string.
is_dated#
Returns - true for the constraints that need a date (Snet, Snlt, Fnet, Fnlt, Mso, Mfo), false for Asap and Alap.
as_str#
Returns - the lowercase name of the variant, e.g. "mfo" for ConstraintType::Mfo. ConstraintType::parse accepts it back.
Example#
use ;
Related#
TaskData- carries the constraint and its dateSchedulingConfig-apply_constraintsturns constraints onViolation- the bound a constraint conflict reports- Links, constraints and summaries - how each constraint moves a task and when it conflicts with links