Trait meio::LiteTask [−][src]
pub trait LiteTask: Sized + Send + 'static { type Output: Send; fn name(&self) -> String { ... } #[must_use] fn routine<'async_trait>(
self,
stop: StopReceiver
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
where
Self: 'async_trait, { ... } #[must_use] fn interruptable_routine<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
where
Self: 'async_trait, { ... } #[must_use] 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 retry_at(&self, _last_attempt: Instant) -> Instant { ... } fn retry_delay(&self, _last_attempt: Instant) -> Duration { ... } }
Minimalistic actor that hasn’t Address
.
Recommended to implement sequences or intensive loops (routines).
Associated Types
Loading content...Provided methods
fn name(&self) -> String
[src]
Returns unique name of the LiteTask
.
Uses Uuid
by default.
#[must_use]fn routine<'async_trait>(
self,
stop: StopReceiver
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>> where
Self: 'async_trait,
[src]
#[must_use]
fn routine<'async_trait>(self,
stop: StopReceiver
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>> where
Self: 'async_trait,
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
#[must_use]fn interruptable_routine<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>> where
Self: 'async_trait,
[src]
#[must_use]
fn interruptable_routine<'async_trait>(self
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>> where
Self: 'async_trait,
Routine that can be unconditionally interrupted.
#[must_use]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,
[src]
#[must_use]
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,
Routine that will be repeated till fail or success.
To stop it you should return Some(value)
.
fn retry_at(&self, _last_attempt: Instant) -> Instant
[src]
When to do the next attempt for repeatable_routine
.
fn retry_delay(&self, _last_attempt: Instant) -> Duration
[src]
How long to wait to retry. Called by retry_at
method.
Implementors
impl<I> LiteTask for InteractionTask<I> where
I: Interaction,
[src]
impl<I> LiteTask for InteractionTask<I> where
I: Interaction,
[src]