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
use id::*;
use qdf::*;
#[derive(Debug, Clone)]
pub struct Space<S>
where
S: State,
{
id: ID,
state: S,
}
impl<S> Space<S>
where
S: State,
{
#[inline]
pub(crate) fn new(id: ID, state: S) -> Self {
Self { id, state }
}
#[inline]
pub fn id(&self) -> ID {
self.id
}
#[inline]
pub fn state(&self) -> &S {
&self.state
}
#[inline]
pub(crate) fn apply_state(&mut self, state: S) {
self.state = state;
}
}
impl<S> Default for Space<S>
where
S: State,
{
#[inline]
fn default() -> Self {
Self::new(ID::new(), S::default())
}
}