Trait tiny_tokio_actor::Actor [−][src]
pub trait Actor<E: SystemEvent>: Clone + Send + Sync + 'static { #[must_use] fn pre_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut ActorContext<E>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, { ... } #[must_use] fn post_stop<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut ActorContext<E>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, { ... } }
Basic trait for actors. Allows you to define tasks that should be run before actor startup, and tasks that should be run after the actor is stopped.
Provided methods
#[must_use]fn pre_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut ActorContext<E>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn pre_start<'life0, 'life1, 'async_trait>(&'life0 mut self,
_ctx: &'life1 mut ActorContext<E>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Override this function if you like to perform initialization of the actor
#[must_use]fn post_stop<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut ActorContext<E>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
#[must_use]
fn post_stop<'life0, 'life1, 'async_trait>(&'life0 mut self,
_ctx: &'life1 mut ActorContext<E>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Override this function if you like to perform work when the actor is stopped