may_actor 0.1.0

Simple Actor library based on MAY
Documentation

Build Status Build status Current Crates.io Version Document

may_actor

rust native actor library based on may

Usage

extern crate may_actor;
use may_actor::Actor;

fn main() {
    struct HelloActor(u32);
    let a = Actor::new(HelloActor(0));

    a.call(|me| {
        me.0 = 10;
        println!("hello world");
    });
    // the view would wait previous messages process done
    a.view(|me| println!("actor value is {}", me.0));
}

for a detailed example, please see pi.rs

Features

  • send message via closure (Actor.call())
  • view internal actor state via closure (Actor.view())
  • convert from raw instance reference to Actor (Actor.from())
  • allow panic inside a closure message

Notice

This simple library doesn't support spawn actors across processes

License

may_actor is licensed under either of the following, at your option: