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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#![crate_name = "riker"]
extern crate bytes;
extern crate chrono;
extern crate config;
extern crate futures;
extern crate regex;
#[macro_use]
extern crate log;
extern crate rand;
extern crate uuid;
mod validate;
pub mod actor;
pub mod futures_util;
pub mod kernel;
pub mod model;
pub mod protocol;
pub mod system;
use std::env;
use futures::Future;
use config::{Config, File};
use futures_util::DispatchHandle;
pub trait ExecutionContext {
fn execute<F>(&self, f: F) -> DispatchHandle<F::Item, F::Error>
where F: Future + Send + 'static,
F::Item: Send + 'static,
F::Error: Send + 'static;
}
pub fn load_config() -> Config {
let mut cfg = Config::new();
let path = env::var("RIKER_CONF").unwrap_or("config/riker.toml".into());
cfg.merge(File::with_name(&format!("{}", path)).required(true)).unwrap();
let path = env::var("APP_CONF").unwrap_or("config/app".into());
cfg.merge(File::with_name(&format!("{}", path)).required(false)).unwrap();
cfg
}
pub mod actors {
pub use model::Model;
pub use protocol::{Message, ActorMsg, ChannelMsg, Identify, SystemEnvelope, SystemMsg, SystemEvent, IOMsg, ESMsg, CQMsg};
pub use ExecutionContext;
pub use actor::*;
pub use system::{ActorSystem, Evt,Timer};
pub use load_config;
}