Trait theatre::actors::supervisor::Supervised[][src]

pub trait Supervised: Actor {
#[must_use]    fn new<'life0, 'async_trait>(
        context: &'life0 mut Context<Self>
    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
    where
        Self: Sized,
        'life0: 'async_trait,
        Self: 'async_trait
; #[must_use] fn restarting<'life0, 'async_trait>(
        reason: ActorStopReason,
        ctx: &'life0 mut Context<Self>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        Self: Sized + Supervised,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... } }

In order for an Supervisor to supervise an actor, an actor needs to implement this trait to provide new instances of the actor if it stops for whatever reason.

Required methods

#[must_use]fn new<'life0, 'async_trait>(
    context: &'life0 mut Context<Self>
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>> where
    Self: Sized,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Construct a new instance of the actor

Loading content...

Provided methods

#[must_use]fn restarting<'life0, 'async_trait>(
    reason: ActorStopReason,
    ctx: &'life0 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    Self: Sized + Supervised,
    'life0: 'async_trait,
    Self: Send + 'async_trait, 
[src]

This method is called whenever the actor has shutdown and the supervisor has begun to restart the actor with a new context

Loading content...

Implementors

Loading content...