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
instancemust implement Send because it may be moved to other thread. -
it is not necessary that the
instanceto impl Sync because theinstancewill 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§
Sourcefn exec(&mut self) -> PeriodicTaskResult
fn exec(&mut self) -> PeriodicTaskResult
A task entry point. The task should return a PeriodicTaskResult.