SkillOp#

The comparison a SkillMatch applies to a worker's skill value. It's the type of SkillMatch::op. The default is SkillOp::AtLeast. The SkillMatch::at_least, SkillMatch::no_more and SkillMatch::equal constructors set it for you.

Declaration#

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum SkillOp {
    #[default]
    AtLeast,
    NoMore,
    Equal,
}

Variants#

All comparisons are inclusive and read as worker value <op> match value. SkillMatch gives the value of a skill the worker doesn't list.

Variant Description
AtLeast Default. Holds when the worker's value is >= the match value.
NoMore Holds when the worker's value is <= the match value.
Equal Holds when the worker's value is == the match value.

Example#

use plen_assign::{SkillMatch, SkillOp};

fn main() {
    let senior = SkillMatch::at_least("rust", 3.0);
    let no_driver = SkillMatch::equal("driver", 0.0);

    assert_eq!(senior.op, SkillOp::AtLeast);
    assert_eq!(no_driver.op, SkillOp::Equal);
    assert_eq!(SkillOp::default(), SkillOp::AtLeast);
}