Trait overclock::core::Actor

source ·
pub trait Actor<S>: Sized + Sendwhere
    S: Send,{
    type Data: Send + 'static;
    type Channel: Channel;

    const VERSION: usize = 1usize;

    // Required methods
    fn init<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        rt: &'life1 mut Rt<Self, S>
    ) -> Pin<Box<dyn Future<Output = ActorResult<Self::Data>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        rt: &'life1 mut Rt<Self, S>,
        data: Self::Data
    ) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn type_name() -> &'static str { ... }
}
Expand description

The all-important Actor trait. This defines an Actor and what it do.

Required Associated Types§

source

type Data: Send + 'static

Allows specifying an actor’s startup dependencies and data.

source

type Channel: Channel

The type of channel this actor will use to receive events

Provided Associated Constants§

source

const VERSION: usize = 1usize

The version of the actor state

Required Methods§

source

fn init<'life0, 'life1, 'async_trait>( &'life0 mut self, rt: &'life1 mut Rt<Self, S> ) -> Pin<Box<dyn Future<Output = ActorResult<Self::Data>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Used to initialize the actor.

source

fn run<'life0, 'life1, 'async_trait>( &'life0 mut self, rt: &'life1 mut Rt<Self, S>, data: Self::Data ) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The main function for the actor

Provided Methods§

source

fn type_name() -> &'static str

Get this actor’s type name

Implementors§