pub trait Tick: Actor {
// Required method
fn tick<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Provides an actor with a “tick” method, that will be called whenever a timer elapses.
Note: spurious tick events may be received: the expectation is that
actors respond to this event by checking if any timers have elapsed.
The Timer
struct has a tick()
method for this purpose.
This trait is defined using the #[async_trait]
attribute as follows:
ⓘ
#[async_trait]
pub trait Tick: Actor {
/// Called whenever a timer might have elapsed.
async fn tick(&mut self) -> ActorResult<()>;
}