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
62
63
64
65
66
67
68
69
70
71
72
//! Kay is an experimental high-performance distributed actor system framework for Rust.
//! It is developed as a component for [Citybound](https://cityboundsim.com)
//! (a city simulation game) but aims to be general-purpose.
//!
//! Kay is inspired by Erlang/OTP and similar actor-oriented approaches,
//! since it allows you to **build a distributed application from isolated actors
//! that communicate only through message-passing,** which works transparently across
//! processor and even network boundaries.
//!
//! The main abstractions are [Classes](TODO) of actors that live inside an [Actor System](TODO),
//! adressed by [TypedID](TODO)s. [Classes](TODO) can implement [Traits](TODO), allowing generic dynamic dispatch.
//!
//! Kay lacks many higher level features and error-handling mechanisms that other actor system frameworks offer
//! since it puts a focus on high-performance and memory efficiency. This is achieved
//! by storing actor state and message queues in consecutive chunks of memory,
//! inspired by the data-oriented game engine design philosophy.
//! The [Compact](https://TODO) library is used to help with this, offering
//! serialisation-free linear memory layouts for plain old data and nested datastructures.
//! This does, in turn, impose the constraint that actor state and messages need to implement
//! [Compact](https://TODO)

#![warn(missing_docs)]
#![feature(core_intrinsics)]
#![feature(optin_builtin_traits)]
#![feature(specialization)]
#![feature(box_syntax)]
extern crate chunky;
extern crate compact;
#[macro_use]
extern crate compact_macros;
extern crate byteorder;
extern crate core;
#[cfg(feature = "browser")]
#[macro_use]
extern crate stdweb;
#[cfg(feature = "server")]
extern crate tungstenite;
extern crate url;
#[cfg(feature = "serde-serialization")]
#[macro_use]
extern crate serde_derive;
#[cfg(feature = "serde-serialization")]
extern crate serde;

macro_rules! make_array {
    ($n:expr, $constructor:expr) => {{
        let mut items: [_; $n] = ::std::mem::uninitialized();
        for (i, place) in items.iter_mut().enumerate() {
            ::std::ptr::write(place, $constructor(i));
        }
        items
    }};
}

mod tuning;
mod actor;
mod actor_system;
mod external;
mod id;
mod class;
mod messaging;
mod networking;
mod storage_aware;
mod type_registry;

pub use self::actor::{Actor, ActorOrActorTrait, TraitIDFrom};
pub use self::actor_system::{ActorSystem, World};
pub use self::external::External;
pub use self::id::{MachineID, RawID, TypedID};
pub use self::messaging::{Fate, Message, Packet};
pub use self::networking::Networking;
pub use self::tuning::Tuning;