pub trait ServiceTask: Sync + Send {
// Required method
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn description(&self) -> String { ... }
}Required Methods§
Sourcefn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes a single iteration of the task. This method is called repeatedly at the specified interval until shutdown or task completion.
§Returns
NoneorSome(false)- Task completed normally, continue running the serviceSome(true)- Task completed and requests service shutdown
Provided Methods§
Sourcefn description(&self) -> String
fn description(&self) -> String
Returns a human-readable description of the task for logging and monitoring. Implementations should provide meaningful descriptions of their purpose.
§Returns
- String describing the task’s purpose, default is “unknown”