comparison 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
comparison
equal deleted inserted replaced
284:8ea6c90774e3 587:646f03870762
1 extern crate robots;
2
3 mod sensor;
4
5 use std::sync::Arc;
6 use std::time::Duration;
7
8 use robots::actors::{Actor, ActorSystem, ActorCell, ActorContext, Props};
9
10 fn main() {
11 println!("Wort Templog");
12 let actor_system = ActorSystem::new("templog".to_string());
13
14 let props = Props::new(Arc::new(sensor::Sensor::new), ());
15 let sensor = actor_system.actor_of(props, "sensor".to_string());
16
17 actor_system.tell(sensor, "yeah".to_string());
18
19 std::thread::sleep(Duration::from_millis(100));
20 actor_system.shutdown();
21
22
23 }
24