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
use crate::system::{BoxedSystem, System, SystemMeta};
use super::{RunCriteriaContainer, SystemDescriptor, SystemLabelId};
#[derive(Debug)]
pub struct SystemContainer {
system: BoxedSystem<(), ()>,
labels: Vec<SystemLabelId>,
before: Vec<SystemLabelId>,
after: Vec<SystemLabelId>,
run_criteria: RunCriteriaContainer,
dependencies: Vec<usize>,
}
impl SystemContainer {
#[inline]
pub fn from_descriptor(descriptor: SystemDescriptor) -> Self {
Self {
system: descriptor.system,
labels: descriptor.labels,
before: descriptor.before,
after: descriptor.after,
run_criteria: RunCriteriaContainer::new(descriptor.run_criteria),
dependencies: Vec::new(),
}
}
#[inline]
pub fn meta(&self) -> &SystemMeta {
self.system.meta()
}
#[inline]
pub fn name(&self) -> &str {
self.system.meta().name()
}
#[inline]
pub fn system(&self) -> &dyn System<In = (), Out = ()> {
self.system.as_ref()
}
#[inline]
pub fn system_mut(&mut self) -> &mut dyn System<In = (), Out = ()> {
self.system.as_mut()
}
#[inline]
pub fn dependencies(&self) -> &[usize] {
&self.dependencies
}
#[inline]
pub fn dependencies_mut(&mut self) -> &mut Vec<usize> {
&mut self.dependencies
}
#[inline]
pub fn run_criteria(&self) -> &RunCriteriaContainer {
&self.run_criteria
}
pub fn run_criteria_mut(&mut self) -> &mut RunCriteriaContainer {
&mut self.run_criteria
}
#[inline]
pub fn should_run(&self) -> bool {
self.run_criteria.should_run().into()
}
#[inline]
pub fn labels(&self) -> &[SystemLabelId] {
&self.labels
}
#[inline]
pub fn before(&self) -> &[SystemLabelId] {
&self.before
}
#[inline]
pub fn after(&self) -> &[SystemLabelId] {
&self.after
}
}