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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#[allow(unused_imports)]
#[macro_use]
extern crate v11_macros;
#[macro_use]
extern crate procedural_masquerade;
pub extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
pub extern crate erased_serde;
extern crate itertools;
#[doc(hidden)]
pub extern crate num_traits;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate mopa;
use std::sync::*;
#[macro_use]
pub mod domain;
#[macro_use]
pub mod table_macro;
pub mod tables;
#[macro_use]
pub mod property;
#[doc(hidden)]
pub mod intern;
pub mod columns;
pub mod index;
pub mod map_index;
pub mod storage;
pub mod tracking;
pub mod event;
#[macro_use]
pub mod context;
pub mod joincore;
mod assert_sorted;
pub mod any_slice;
mod serial;
#[cfg(feature = "doc")]
pub mod examples;
#[cfg(not(feature = "doc"))]
pub mod examples {}
#[cfg(feature = "doc")]
#[doc(hidden)]
pub mod v11 {
pub use super::*;
}
pub trait Storable: 'static + Send + Sync + Sized {
#[doc(hidden)]
fn assert_no_drop() {
if ::std::mem::needs_drop::<Self>() {
panic!("Column element needs_drop");
}
}
}
impl<T> Storable for T where T: 'static + Send + Sync + Sized {}
pub type GuardedUniverse = Arc<RwLock<Universe>>;
use domain::{DomainName, MaybeDomain};
pub struct Universe {
#[doc(hidden)] pub domains: Vec<MaybeDomain>,
pub event_handlers: ::event::EventHandlers,
}
impl Universe {
pub fn new(domains: &[DomainName]) -> Universe {
let mut ret = Universe {
domains: Self::get_domains(domains),
event_handlers: Default::default(),
};
for domain in domains {
ret.init_domain(*domain);
}
ret
}
pub fn guard(self) -> GuardedUniverse { Arc::new(RwLock::new(self)) }
pub fn info(&self) -> String {
let mut out = "".to_owned();
for domain in &self.domains {
let domain = match *domain {
MaybeDomain::Unset(_) => continue,
MaybeDomain::Domain(ref i) => i,
};
use itertools::Itertools;
let info: String = domain.tables.iter().map(|(_, table)| {
table.read().unwrap().info()
}).join(" ");
out += &format!("{}: {}\n", domain.name, info);
}
out
}
}
use std::fmt;
impl fmt::Debug for Universe {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "Universe:")?;
for domain in &self.domains {
writeln!(f, "\t{:?}", domain)?;
}
write!(f, "")
}
}
#[derive(Debug, Clone)]
pub enum Action<IT> {
Continue {
remove: bool,
add: IT,
},
Break,
}