Trait TaskGroup

Source
pub trait TaskGroup:
    Send
    + Sync
    + Sized
    + 'static {
    type TaskId: Send;

    // Required methods
    fn get_tasks(&self) -> Vec<Self::TaskId>;
    fn execute(&self, _: Self::TaskId);
}
Expand description

Defines a group of tasks. Task groups allow you to schedule the execution of different tasks uniformly in a specific interval. The task discovery will be performed by get_tasks that will return a list of task ids. The returned task ids will be used by the execute function to run the specified task. get_tasks will be executed one per interval, while execute will be executed every interval / number of tasks. See also: example in the module documentation.

Required Associated Types§

Required Methods§

Source

fn get_tasks(&self) -> Vec<Self::TaskId>

Runs at the beginning of each cycle and generates the list of task ids.

Source

fn execute(&self, _: Self::TaskId)

Runs once per task id per cycle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§