Skip to main content

Actor

Trait Actor 

Source
pub trait Actor: Send + Sync {
    // Required methods
    fn actor_id(&self) -> &str;
    fn actor_status(&self) -> ActorStatus;
    fn initialize<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Actor trait for swarm participants

An Actor is an entity that can participate in the swarm by receiving and processing messages. This is the base trait for all swarm participants.

Required Methods§

Source

fn actor_id(&self) -> &str

Get the unique identifier for this actor

Source

fn actor_status(&self) -> ActorStatus

Get the actor’s current status

Source

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the actor for swarm participation

Source

fn shutdown<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shutdown the actor gracefully

Implementors§

Source§

impl Actor for Agent

Actor implementation for Agent - enables swarm participation