Worker#
A resource that can be assigned, paired with its skill values. Workers go into Pool::workers, which slots reads. There's no constructor and no Default; build it with a struct literal.
Declaration#
Fields#
resource#
pub resource: Id
Id of a resource in the project's accepted state. When the worker matches a requirement, this id goes into the slot's allowed list.
skills#
pub skills:
The worker's skill values, one Skill per skill id. The list can be empty. For how an unlisted skill compares, see SkillMatch.
Errors#
An invalid worker makes slots return Err(MatchError::Invalid) at the field's path, where i is the worker's index in the pool and j the skill's index.
| Field | When it occurs | Path | Message |
|---|---|---|---|
resource |
no resource with this id in the accepted state | pool.workers[i].resource |
unknown resource "<id>" |
resource |
an earlier worker in the pool names the same resource | pool.workers[i].resource |
duplicate worker "<id>" |
skills |
the worker already lists this skill id | pool.workers[i].skills[j].id |
duplicate skill "<id>" |
skills |
the value is NaN or infinite |
pool.workers[i].skills[j].value |
must be finite |
Example#
use ;
Related#
Pool- holds the workers in pool orderSkill- one entry ofskillsSkillMatch- tests a worker's skill values- Skills and Requirements - shows how to describe workers and their skills