SuggestStep#
One decision of Project::suggest_assignments that changed the working state: a slot was filled, repaired or moved to another resource. Read the steps from SuggestResult::steps, in the order they were taken. A slot that ends with no change produces no step.
Declaration#
With the serde feature, SuggestStep also implements Serialize and Deserialize, with camelCase field names.
Fields#
| Field | Type | Description |
|---|---|---|
slot |
Id |
Id of the Slot this step changed. |
task |
Id |
The slot's task. |
pass |
u32 |
0 for a fill or a repair; 1 and up for the rebalance pass the step was taken in. |
from_resource |
Option<Id> |
The resource the slot held before the step. None when the step filled an empty slot. |
to_resource |
Id |
The resource the slot holds after the step. Never empty: a step never removes an assignment. |
cost |
StepCost |
State cost before and after the step. |
Step kinds#
SuggestStep has no kind field. Tell the kind from from_resource and pass:
from_resource |
pass |
Kind |
|---|---|---|
None |
0 |
Fill: an empty slot got a resource. |
Some(_) |
0 |
Repair: a resource outside the slot's allowed was replaced. |
Some(_) |
1.. |
Rebalance: a valid slot moved to a cheaper resource. |
Which slots are filled, repaired or rebalanced depends on SuggestOptions::targets. For how each kind picks its resource, see Suggesting assignments.
Example#
use ;
// Print the step log of a suggest_assignments proposal.
Related#
SuggestResult- lists these steps instepsStepCost- the cost record each step carriesAssignTarget- decides which step kinds a call can take- Suggesting assignments - shows reading the step log and telling the step kinds apart