pub trait ServiceTask {
// Required methods
fn service_name(&self) -> String;
fn run_service_check<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn should_run(&self) -> bool;
// Provided method
fn should_run_last_interval(
&self,
last_run: Option<SystemTime>,
interval: Duration,
) -> bool { ... }
}Required Methods§
Sourcefn service_name(&self) -> String
fn service_name(&self) -> String
To identify service task
fn run_service_check<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn should_run(&self) -> bool
fn should_run(&self) -> bool
ServiceTasks are triggered often ( 1s interval ) This method should tell whether run also this ServiceTask in current run.
Provided Methods§
Sourcefn should_run_last_interval(
&self,
last_run: Option<SystemTime>,
interval: Duration,
) -> bool
fn should_run_last_interval( &self, last_run: Option<SystemTime>, interval: Duration, ) -> bool
Should run when elapsed time from last run is higher then interval