Commit 0e927ff8 authored by Ralf's avatar Ralf

Merge branch 'master' of hacksaar.de:hacksaar/rinx

parents ef6c146d 8cb971ab
......@@ -4,6 +4,19 @@
use std::fmt;
use actors::Actor;
/// The `ForwardActor` forwards actions to the global book keeper
pub struct ForwardActor<T> {
dummy: T,
}
// TODO keep a handle to the global book keeper in this struct
impl<T: Send+fmt::Debug> Actor<T> for ForwardActor<T> {
fn act(&mut self, t: T) {
println!("{:?}", t);
unimplemented!();
}
}
/// The `RecordActor` just records the action in a `Vec`.
pub struct RecordActor<T> {
record: Vec<T>,
......
......@@ -15,6 +15,15 @@ pub struct Actors {
buzz: Box<Actor<bool>>,
}
/// Corresponds to the position of the respective actor in struct Actors.
/// It is used for testing, to check that the correct actor is activated.
#[derive(Copy,Clone,Debug,PartialEq,Eq)]
pub enum ActorType {
GreenLed,
Lock,
Buzz,
}
/// A [Situation] is something that can deal with all events coming in at a
/// particular time. It has access to the actors and can handle events by
/// using the [Environment]. When done, it has to return back all the actors,
......
......@@ -14,6 +14,7 @@ pub mod util;
pub mod input;
pub mod actors;
pub mod brain;
pub mod testing;
// FIXME everything below here is just a sketch
......
use std::fmt::Debug;
use brain::ActorType;
use testing::TestableEvent;
#[derive(Copy,Clone,Debug,PartialEq,Eq)]
struct ActorActed<T>
where T: PartialEq + Eq + Debug + Copy + Clone
{
actor: ActorType,
act: T,
}
impl<T> TestableEvent for ActorActed<T>
where T: PartialEq + Eq + Debug + Copy + Clone
{}
use std::fmt::Debug;
use std::cmp::Eq;
trait TestableEvent: Debug + Eq {}
mod events;
mod book_keeper;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment