SkillMatch#
One skill condition of a Requirement: a skill id, a comparison and a value. A worker satisfies the match when worker value <op> value holds. Build one with SkillMatch::at_least, SkillMatch::no_more or SkillMatch::equal, or with a struct literal, and put it in Requirement::matches.
Declaration#
Fields#
| Name | Type | Description |
|---|---|---|
skill |
Id |
Id of the Skill to compare. |
op |
SkillOp |
The comparison: >=, <= or ==, all inclusive. |
value |
f64 |
The value the worker's skill value is compared with. Must be finite. |
A worker without the skill has the value 0. So SkillMatch::at_least("qa", 1.0) excludes that worker, and SkillMatch::no_more("qa", 0.0) includes it.
A non-finite value is reported by slots as MatchError::Invalid at requirements[i].matches[j].value.
Associated functions#
at_least#
Creates a match that holds when the worker's skill value is >= value.
| Name | Type | Description |
|---|---|---|
skill |
impl Into<Id> |
Skill id. |
value |
f64 |
Minimum value, inclusive. |
Returns a SkillMatch with op: SkillOp::AtLeast.
no_more#
Creates a match that holds when the worker's skill value is <= value.
| Name | Type | Description |
|---|---|---|
skill |
impl Into<Id> |
Skill id. |
value |
f64 |
Maximum value, inclusive. |
Returns a SkillMatch with op: SkillOp::NoMore.
equal#
Creates a match that holds when the worker's skill value is == value.
| Name | Type | Description |
|---|---|---|
skill |
impl Into<Id> |
Skill id. |
value |
f64 |
Required value. |
Returns a SkillMatch with op: SkillOp::Equal.
Example#
A requirement for a backend developer with a QA grade of at least 2 who isn't a trainee:
use ;
Related#
Requirement- holds the matches in itsmatcheslistSkill- the worker value a match compares againstSkillOp- the comparison inopslots- evaluates the matches to fill each slot'sallowedlist- Skills and Requirements - shows how to combine skill conditions in a requirement