schedule_state#
Schedules data once and returns a StateDoc: the final task dates and conflicts, sorted so that two runs can be compared field by field. It backs the CLI's schedule --format state output.
Unstable
Signature#
Parameters#
| Name | Type | Description |
|---|---|---|
data |
ProjectData |
Project to schedule. Consumed. |
options |
&SolveOptions |
Scheduling options for this run. |
data is validated strictly. There's no ProjectOptions argument, so Validation::Repair isn't available.
Returns#
Ok(StateDoc) with every imported task, every conflict, and run metadata.
StateDoc#
| Field | Type | Description |
|---|---|---|
tasks |
Vec<StateTask> |
One entry per imported task, sorted by id. |
conflicts |
Vec<StateConflict> |
Dependency cycles and scheduling conflicts, sorted by kind, then by tasks. |
meta |
StateMeta |
Run metadata. |
StateTask#
| Field | Type | Description |
|---|---|---|
id |
String |
Task id in its normalized string form. |
start |
DateTime |
Scheduled start. |
end |
DateTime |
Scheduled end. |
StateConflict#
| Field | Type | Description |
|---|---|---|
kind |
String |
"cycle", "calendar-non-working" or "constraint-violation". |
tasks |
Vec<String> |
Ids of the tasks involved. A cycle lists all its tasks, sorted; the other kinds list one task. |
constraint_type |
Option<ConstraintType> |
Some only for "constraint-violation". |
violation |
Option<Violation> |
Some only for "constraint-violation". |
required |
Option<DateTime> |
Some only for "constraint-violation". |
actual |
Option<DateTime> |
Some only for "constraint-violation". |
"calendar-non-working" and "constraint-violation" are flattened from Conflict; see that page for what each one means.
StateMeta#
| Field | Type | Description |
|---|---|---|
engine |
&'static str |
Always "rust". |
ok |
bool |
Always true; failures return Err instead. |
converged |
bool |
Whether scheduling converged, as in ScheduleResult. |
iterations |
u32 |
Scheduling iterations used. |
notes |
Vec<Note> |
Notes from the run. |
All four types derive Clone and Debug. With the serde feature they also implement Serialize; the Option fields of StateConflict are left out when None.
Errors#
| Error | When it occurs |
|---|---|
Error::Input |
data fails validation, or options scopes the run to a task that's unknown or unscheduled. |
Dependency cycles aren't errors here. They appear in conflicts with kind: "cycle".
Example#
use ;
Related#
schedule- the stable one-shot call to use insteadScheduleResult- the full result the snapshot is built from