Job

Trait Job 

Source
pub trait Job: Send {
    type Exclusion: PartialEq + Copy + Debug + Send;
    type Priority: Ord + Copy + Send;

    // Required methods
    fn exclusion(&self) -> Self::Exclusion;
    fn priority(&self) -> Self::Priority;
    fn execute(self);
}
Expand description

A job which can be executed by the runner, with features to synchronise jobs that would interfere with each other and reduce the parallelisation of low priority jobs

Required Associated Types§

Source

type Exclusion: PartialEq + Copy + Debug + Send

Type used to check which jobs should not be allowed to run concurrently, see Job::exclusion(). Use NoExclusion for jobs which can always be run at the same time, see also ExclusionOption.

Source

type Priority: Ord + Copy + Send

Type of the priority, the higher prioritys are those which are larger based on Ord::cmp.

Required Methods§

Source

fn exclusion(&self) -> Self::Exclusion

Used to check which jobs should not be allowed to run concurrently, if <Job::Exclusion as PartialEq>::eq(job1.exclusion(), job2.exclusion()), then job1 and job2 can’t run at the same time.

Source

fn priority(&self) -> Self::Priority

Get the priority of this thing

Source

fn execute(self)

Execute and consume the job

Implementors§

Source§

impl<T> Job for T
where T: FnOnce() + Send,