PeriodicTask

Trait PeriodicTask 

Source
pub trait PeriodicTask: Send + 'static {
    // Required method
    fn exec(&mut self) -> PeriodicTaskResult;
}
Expand description

A trait which should be implemented by the instance which will be added as a task.

  • the instance must implement Send because it may be moved to other thread.

  • it is not necessary that the instance to impl Sync because the instance will never be executed from two different threads and it is already protected by mutex.

A task should never block the thread i.e call some functions which may block for a large period of time!

Required Methods§

Source

fn exec(&mut self) -> PeriodicTaskResult

A task entry point. The task should return a PeriodicTaskResult.

Implementors§