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
35
36
37
use std::rc::Rc;
use std::cell::RefCell;
pub mod activate;
pub use self::activate::{Activations, Activator, ActivateOnDrop, SyncActivator};
pub trait Schedule {
fn name(&self) -> &str;
fn path(&self) -> &[usize];
fn schedule(&mut self) -> bool;
}
pub trait Scheduler {
fn activations(&self) -> Rc<RefCell<Activations>>;
fn activator_for(&self, path: &[usize]) -> Activator {
let activations = self.activations().clone();
Activator::new(path, activations)
}
fn sync_activator_for(&self, path: &[usize]) -> SyncActivator {
let sync_activations = self.activations().borrow().sync();
SyncActivator::new(path, sync_activations)
}
}