seal_rs 0.3.2

Set of classic asynchronous primitives (Actors, Executors, Futures / Promises)
Documentation
use crate::actors::actor::Actor;
use crate::actors::actor_context::ActorContext;
use std::any::Any;


pub struct Pong {
    pub v: u32,
}


pub struct Boo {
 some_data: u32
}

impl Boo {
    pub fn new() -> Boo {
        Boo {
            some_data: 0
        }
    }
}

impl Actor for Boo {
    fn pre_start(self: &mut Self, ctx: ActorContext) {
        //println!("boo preStart");
        //println!("self = {}", ctx.self_);
        //println!("sender = {}", ctx.sender);
    }

    fn post_stop(self: &mut Self, ctx: ActorContext) {
        println!("boo postStop");
    }

    fn receive(self: &mut Self, msg: &Box<Any + Send>, ctx: ActorContext) -> bool {
        /*println!("self = {}", ctx.self_);
        println!("sender = {}", ctx.sender);


        if let Some(Zoom {}) = msg.downcast_ref::<Zoom>() {
            println!("it was Zoom!")
        } else if let Some(Ping { v, xt }) = msg.downcast_ref::<Ping>() {
            println!("it was Ping! v = {}, xt={}", v, xt)
        } else {
            println!("Unknown message")
        }


        self.some_data = 100;*/
        self.some_data = 100;

        true
    }
}