seal_rs 0.1.0

Set of classic asynchronous primitives (Actors, Executors, Futures / Promises)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Actor trait
//!
//! This trait must be realized by the structure, which want to be involved to the system as
//! a particular actor.
use crate::actors::actor_context::ActorContext;
use std::any::Any;

pub trait Actor {
    fn pre_start(self: &mut Self, ctx: ActorContext) {}
    fn post_stop(self: &mut Self, ctx: ActorContext) {}
    fn receive(self: &mut Self, msg: &Box<Any + Send>, ctx: ActorContext) -> bool;
}

/// Service message. Stops the actor which will receive him. See  actors lifetime management
/// articles in the main doc, for more details, about how this message works.
pub struct PoisonPill {}