sprite-core 0.1.7

Sprite Engine — a fault-tolerant actor runtime for Rust
Documentation
use sprite_core::{Engine, Message, Pool};

fn main() {
    let engine = Engine::new();

    let pool = Pool::new(&engine, "worker", 4, |ctx| {
        let id = ctx.id();
        let name = ctx.name().to_string();
        ctx.on_message(move |msg| {
            println!("Worker {} ({}) processing: {:?}", name, id, msg);
        });
    });

    std::thread::sleep(std::time::Duration::from_millis(20));

    for i in 0..8 {
        pool.send(Message::int(i));
    }

    std::thread::sleep(std::time::Duration::from_millis(100));
}