Trait meio::prelude::LiteTask [−][src]
pub trait LiteTask: Sized + Send + 'static {
type Output: Send;
fn log_target(&self) -> &str;
fn routine<'async_trait>(
self,
stop: StopReceiver
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
where
Self: 'async_trait,
{ ... }
fn interruptable_routine<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
where
Self: 'async_trait,
{ ... }
fn pre_repeatable_routine<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn repeatable_routine<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Option<Self::Output>, Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn routine_wait<'life0, 'async_trait>(
&'life0 mut self,
_last_attempt: Instant,
_succeed: bool
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
}
Expand description
Minimalistic actor that hasn’t Address
.
Recommended to implement sequences or intensive loops (routines).
Associated Types
Required methods
fn log_target(&self) -> &str
fn log_target(&self) -> &str
The log target for the LiteTask
.
Provided methods
Routine of the task that can contain loops. It can taks into accout provided receiver to implement graceful interruption.
By default uses the following calling chain that you can override at any step:
routine
-> interruptable_routine
-> repeatable_routine
-> retry_at
-> retry_delay
Routine that can be unconditionally interrupted.
Called before repeatable_routine
for initialization.
The routine will be interrupted if this method failed.
Routine that will be repeated till fail or success.
To stop it you should return Some(value)
.