overclock::core

Trait Actor

Source
pub trait Actor<S>: Sized + Send
where 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.

Provided Associated Constants§

Source

const VERSION: usize = 1usize

The version of the actor state

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

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§