view rust/src/main.rs @ 587:646f03870762 rust

trying rust
author Matt Johnston <matt@ucc.asn.au>
date Wed, 14 Dec 2016 00:15:14 +0800
parents
children 038734052b20
line wrap: on
line source

extern crate robots;

mod sensor;

use std::sync::Arc;
use std::time::Duration;

use robots::actors::{Actor, ActorSystem, ActorCell, ActorContext, Props};

fn main() {
    println!("Wort Templog");
    let actor_system = ActorSystem::new("templog".to_string());

    let props = Props::new(Arc::new(sensor::Sensor::new), ());
    let sensor = actor_system.actor_of(props, "sensor".to_string());

    actor_system.tell(sensor, "yeah".to_string());
    
    std::thread::sleep(Duration::from_millis(100));
    actor_system.shutdown();


}