diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rust/src/main.rs	Wed Dec 14 00:15:14 2016 +0800
@@ -0,0 +1,24 @@
+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();
+
+
+}
+