1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![allow(dead_code)]
#![feature(map_first_last)]
mod event;
mod reaction;
mod scheduler;
mod trigger;
pub use event::{Event, EventValue};
pub use reaction::{IsPresent, Port, Reaction};
pub use scheduler::{Sched, Scheduler};
pub use trigger::{QueuingPolicy, Trigger};
pub use std::{
cell::RefCell,
rc::Rc,
time::{Duration, Instant},
};
pub type Index = u64;
type React<S> = Rc<Reaction<S>>;
type Timer<S> = Rc<RefCell<Trigger<S>>>;
type Input<T> = Rc<RefCell<Port<T>>>;
type Output<T> = Rc<RefCell<Port<T>>>;
pub trait Reactor {
fn start_time_step(&self);
fn start_timers<S: Sched>(&self, sched: &mut S);
}